Configuring a router interface is a very important step in route configuration, and there are also many problems. We generally think that When configuring a router to connect to multiple networks, therefore, each network has a network card and an IP address. However, in practice, you may need to create an Intranet to solve the problem of insufficient IP addresses on the Internet, and the workstation often has integrated a NIC on its own motherboard.
1. Configure vro Interfaces
1. Create the/etc/hostname. interface file.
Each connected network should have a hostname. interface file, where interface is the name of the NIC. The interfaces for multiple NICs should be different, but the interfaces for these files are the same for a single Nic router. How can we differentiate these files? You can create a hostname. interface: n file and use n as the difference to virtualize multiple NICs. When the computer starts, it will detect the number of such files. If multiple hostname. interface files are found, they are considered as routers; otherwise, they are considered as hosts. For example, if a SUN Workstation is connected to the Internet and Intranet, two files can be created: hostname. le0 and hostname. le0: 2.
2. assign a host name for the interface
In each of the above hostname. interface files, add the host name. You must note that different network interfaces correspond to the same host, that is, you must use different host names to distinguish different IP addresses. For the above example, use the vi command to edit the two files into sun1 and sun2, which are actually a host.
3. Add the Host Name and IP address to/etc/inet/hosts in the format of IPaddresshostname202.114.209.37sun1180.114.20.1sun2.
Note that the IP address is the IP address of the network adapter that corresponds to multiple networks. 202.114.209.37 is the valid IP address of the host on the Internet, while 180.114.20.1 is the address assigned by the host on the Intranet, the IP address on the Intranet does not have to worry about conflict with the IP address with a duplicate name on the Internet, because the upper-level gateway will regard it as illegal and refuse to provide services.
4. Modify the/etc/inet/netmasks File
If the vro is connected to a subnet, modify/etc/inet/netmasks and enter the subnet network number (such as 129.9.0.0) and Shield number (such as 255.255.255.0 ).
Ii. Routing Protocol Selection
Static or dynamic routing protocols such as RIP and RDISC can be used ). When dynamic routing protocol is selected, you can leave the/etc/defaultrouter file blank. Configuring the router interface will automatically communicate with RIP and RDISC. These protocols track the router and broadcast route information so that the router can work in local file mode. This ensures that the router can work as usual after the configuration of the network server fails.
If you select static protocols, you only need to enter the default router name in the/etc/defaultrouter file, so that when the Unix router cannot find the path routing, the IP packet is sent to the default router. In this example, if misrouter is used as the default router, you also need to add its IP address: 202.114.209.19 and machine name: misrouter in/etc/inet/hosts.
3. restart the computer
When the computer starts, the system calls the ifconfig command to configure the router interface for multiple connected networks and detects multiple hostnames. the interface file exists, so the computer considers itself as a router. A single Nic router is configured. Computers on all intranets can use internal IP addresses to communicate with each other, communication with the Internet is performed through a single Nic's Unix router. It can be seen that although it is a single Nic, It has multiple IP addresses. In essence, it uses the virtual interface file hostname. interface: n to "Impersonate" multiple NICs.