Use Linux system sharing to set up a case

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.