解决方法:
1,设定eth0做lan,
sudo vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.10.1
netmask 255.255.255.0

2,设定eth1做wan,dhcp.
auto eth1
iface eth1 inet dhcp

3,设定一条NAT rule,加入到/etc/rc.local文件中.
iptables -F
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth1 -j SNAT MASQUERADE


4,开启IP转发
修改/etc/sysctl.conf,取消这一行的注释: 
net.ipv4.ip_forward= 1
然后使之立即生效
sudo sysctl -p

相关文章:

  • 2021-11-12
  • 2021-11-26
  • 2021-12-31
  • 2021-11-28
  • 2021-11-20
  • 2021-08-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2022-02-08
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案