Environment: A Linux Machine single card, a window machine single card, a four-port hub.
Background: The landlord only provides a line of Internet access and restricts access to only one network card (the NIC of my Linux machine).
Objective: To bring the window machine into the network through the Linux shared Internet settings.
Methods: Using Linux as a DHCP server, using a hub to make a local area network. The IP request for this network segment is forwarded again.
Establish a Linux DHCP server. If it's an Ubuntu system, direct
#apt-get Install DHCPD
After installation, change the/etc/dhcpd.conf file and add:
Option Domain-name-servers 202.96.134.188,202.96.134.133;
Default-lease-time 600;
Max-lease-time 7200;
Subnet 192.168.1.0 netmask 255.255.255.0 {
Range 192.168.1.2 192.168.1.200;
Option routers 192.168.20.1;
}
DHCP Setup is complete. The next need to set the Linux host more than one IP, and set a good iptable rules.
sudo ifconfig eth0:1 192.168.20.1
sudo sh-c "Echo 1 >/proc/sys/net/ipv4/ip_forward"
sudo iptables-a forward-s 192.168.20.0/24-j ACCEPT
sudo iptables-a forward-i eth0-m state–state established,related-j ACCEPT
You can write the above statement to a script. Doing it when you need it is to turn on shared functionality.
The window machine only needs to be set to automatically obtain IP (or set to 192.168.20.x network segment, the gateway is 192.168.20.1). The physical connection is through the hub.
Each individual situation is different, everybody changes according to oneself circumstance
Note : More wonderful tutorials Please pay attention to the triple computer tutorial section, triple Computer group: 189034526 welcome you to join