Linux dual-nic NAT shared Internet access I. Network Extension Structure: SERVER: Two NICs settings: eth0: 202.96.168.100 mask: 255.255.255.0 Gateway: 202.96.168.68 # With Inte. net associated eth1: 192.168.1.1 mask: 255.255.255.0 # subnet segment of the Client Connected to the LAN: 192.168.1.0/255 www.2cto.com II. Server Settings: (either of the two methods can be used) 1. Use the NAT method to execute the following commands on the server: echo "1">/proc/sys. net/ipv4/ip_forward # enable IP Forwarding. 1 indicates forwarding. 0 indicates not forwarding. You can also modify/etc/sysctl by running the preceding command. conf implementation, adding a line above and below in the file: net. ipv4.ip _ forward = 1 Other commands are: iptables-F iptables-P INPUT ACCE PT iptables-p forward accept iptables-t nat-a postrouting-o eth0-j MASQUERADE # enable NAT www.2cto.com 2.2 and use the bridge method: echo "1">/proc/sys. net/ipv4/ip_forward ifconfig eth0 0.0.0.0 up ifconfig eth1 0.0.0.0 up brctl addbr br0 # Add a bridge brctl addif br0 eth0 brctl addif br0 eth1 # Add eth0 eth1 to the bridge to go to ifconfig br0 limit 255.255. broadcast 192.168.1.255 up # assign an IP address to the bridge, if you do not need NAT or remote access to the bridge P address, but you must enable the bridge (ifconfig br0 up) route add default gw 202.96.168.68 # If the bridge does not need to access other machines, you can not add a gateway. 3. Client settings: eth0: 192.168.1.10 mask: 255.255.255.0 Gateway: 192.168.1.1 4. iptables command reference: iptables command syntax: iptables [-t nat] CMD [chain] [rule-matcher] [-j target]-t nat: indicates the operation of the nat table www.2cto.com CMD: For the operation command chain: for chain name rule-matcher: For rule matching target: iptables-t nat-F # Clear the Rules iptables-F in the original nat table # Clear the Rules iptables-p forward accept in the original filter # Allow IP forwarding by default 5, according to the NAT method, the configuration is completed soon and the Internet can be smoothly accessed. For users who have no special requirements on network configuration, you can use the NAT method, which is simple and practical.