Single NIC workstation as TCP/IP network router

Source: Internet
Author: User

We generally believe that routers are connected to multiple networks, so it should have a network card and an IP address for each. In practice, however, there may be situations where an intranet needs to be built to address the lack of IP addresses on the internet, and workstations often have a single NIC integrated into their motherboard. How do I use existing resources to set up a router? It seems difficult, but the fact that a single NIC workstation can also be configured as a TCP/IP network router. On a Sun workstation equipped with the solaris2.x operating system, you can configure it using the following methods.

First, configure router interface

1. Create/etc/hostname.interface file

Each connected network should have a hostname.interface file, where interface is the code name of the network card. Interface should be different for multiple network adapters, but the interface of these files is the same for single NIC routers. How do you distinguish between these files? You can create hostname.interface:n files and use N to make a difference to virtual multiple network adapters. The number of such files will be detected when the computer starts up, and if multiple hostname.interface files are found, the router is considered a host. For example, if a sun workstation is connected to an Internet network and an intranet, you can create two files that are divided into Hostname.le0 and hostname.le0:2.

2. Assigning host names to interfaces

in each of the above hostname.interface files, add the hostname, you must pay attention to the corresponding network interface, that is, the same host must use different hostname to distinguish between different IP addresses. For the above example, the VI command to edit two files into Sun1 and sun2 respectively, is actually a host.

3. Add the hostname and IP address in/etc/inet/hosts, in the format:

ipaddresshostname

202.114.209.37sun1

180.114.20.1SUN2

Note that IP addresses are different IP addresses for multiple networks of network card connections, where 202.114.209.37 is the legitimate address of the host on the Internet and 180.114.20.1 is an intranet-assigned address, and the IP address on the intranet does not have to worry about an IP address that has the same name as the Internet, because a superior gateway will view it as illegal and refuse to give service. 3lian.com

4. Modify/etc/inet/netmasks file

If the router is connected to a subnet, you should also modify the/etc/inet/netmasks and fill in the local network number (such as 129.9.0.0) and the mask number (for example, 255.255.255.0).

Two, routing protocol selection

can be either static routing protocol or dynamic routing protocol such as routing Information Protocol (RIP) and ICMP seek path Protocol (RDISC).

If you choose a dynamic routing protocol, you can set the/etc/defaultrouter file to null. Routers will automatically talk to rip and Rdisc, which track routers and broadcast routing information, allowing routers to work in local file mode. This will ensure that the router will work as usual after the configuration of the network server is invalidated.

If you choose a static protocol, simply fill in the default router name in the/etc/defaultrouter file so that the IP packet is sent to the default router when the UNIX router cannot find the path route. If this example uses Misrouter as the default router, it also needs to include its IP address in/etc/inet/hosts: 202.114.209.19 and machine name:

Misrouter.

Third, restart the computer

when the computer starts, the Ifconfig command is called inside the system to configure the interface for the connected network and detects that there are multiple hostname.interface files, so the computer thinks of itself as a router.

A single network card router is matched, all internal network computers can communicate with internal IP address, not limited by the assigned limit of IP address, and the

Internet communication is through a single NIC of the UNIX router. It can be seen that although it is a single card, but there are multiple IP addresses, in essence, the use of virtual interface file Hostname.interface:n to "impersonate" multiple network cards.
 

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.