Linux under the dual network card configuration basic tutorial

  

There is no time to touch linux, the key is that this work is completely unknowingly unix-like, I am running away from the road of my dreams...

The actual situation is: 1 win7 system 1 ubuntu 11.04 system, installed 2 network cards, respectively called eth0 (connected to the external network), eth1 (connected to the internal network)

The problem is to let Ubuntu system system connects to the external network, and then use it as a proxy, let win7 and ubuntu connect, so that win7 can also access the Internet.


There are very few steps to implement, that is, the logic is a bit winding.

1, configure /etc/network/interface file on ubuntu





< Br>







2, now you need to configure the NIC of win7

Network connection, local connection properties,

ip address is 192.168.2.103, mask 255.255.255.0, gateway 192.168.2.102


3, The next step is to open the ip forwarding function of the ubuntu system:

sudo vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

and then use sudo sysctl -p The command makes the modification take effect


4. The most step is to set the NAT forwarding rule:



Restart the network connection once, it should Both win7 and ubuntu can go online at the same time!


If you want to auto-forward boot, add

/sbin/iptables -t nat -A POSTROUTING - before exit 0 in the /etc/rc.local file. s 192.168.0.0/24 -o eth1 -j MASQUERADE

Copyright © Windows knowledge All Rights Reserved