|
本帖最后由 hobin 于 2021-10-31 14:06 编辑
1. 网卡配置
/etc/network/interfaces.d/eth0
- auto eth0
- allow-hotplug eth0
- iface eth0 inet static
- address 10.5.6.1
- netmask 255.255.255.0
- auto wan
- allow-hotplug wan
- iface wan inet ppp
- post-up /usr/sbin/iptables -t nat -A POSTROUTING -o wan -j MASQUERADE
- post-up /usr/sbin/iptables -t filter -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
- post-down /usr/sbin/iptables -t nat -D POSTROUTING -o wan -j MASQUERADE
- post-down /usr/sbin/iptables -t filter -D FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
复制代码
2. PPPoE 配置
/etc/ppp/peers/provider
- ifname wan
- noipdefault
- defaultroute
- connect /bin/true
- noauth
- persist
- noaccomp
- default-asyncmap
- plugin rp-pppoe.so eth0
- user "user"
- lcp-echo-failure 20
- lcp-echo-interval 30
复制代码
3. PPPoE 帐号配置
/etc/ppp/pap-secrets
- # * password
- "user" * "password"
复制代码
4. DHCP 配置
/etc/dnsmasq.conf
- interface=eth0
- listen-address=127.0.0.1,10.5.6.1
- dhcp-range=10.5.6.100,10.5.6.200,48h
复制代码
5. 访问光猫
- # 启用
- $ sudo ifconfig eth0:0 10.5.5.2 netmask 255.255.255.0
- $ sudo iptables -t nat -A POSTROUTING -o eth0 -d 10.5.5.0/24 -j MASQUERADE
- $ sudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.5.5.1:80
- # 关闭
- $ sudo ifconfig eth0:0 down
- $ sudo iptables -t nat -D POSTROUTING -o eth0 -d 10.5.5.0/24 -j MASQUERADE
- $ sudo iptables -t nat -D PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.5.5.1:80
复制代码
|
评分
-
查看全部评分
|