How to implement the single-arm router function in LINUX

Source: Internet
Author: User
How to implement the single-arm router function in LINUX-Linux Enterprise Application-Linux server application information, the following is a detailed description. Find a network card such as 3COM (supporting VLAN), patch the VLAN in the kernel, and confirm that you need several network segments to set several IP addresses and then set several MAC addresses. (You can change the MAC address on your own in LINUX ). Simulate your LINUX machine into a vro, which has better effects and wider application scenarios. Example: You have four devices, A, B, C, and D. Among them, A and B are desktop PCs, and C is A router (the gateway of your internal network ), D is a LINUX. Your company requires Intranet/Internet isolation. On A and B, there is an Intranet/Internet physical isolation switch (in simple words, there is A switch on which the switch is physically connected to the Internet, ). In this case, the gateways of A and B are fixed, so we require that the LINUX IP address and the IP address of the C router correspond one to one, and because of the relationship between the ARP table, we have to make sure that the MAC address of LINUX should also correspond to the MAC address of the C router. Otherwise, it will be unavailable for some time when the and B machines switch to the network (waiting for the ARP table to aging ). I don't know if you understand it. Actually, there are many advantages. I will discuss with you the detailed implementation steps and principles at the moment.
++ ++

For a slightly larger network, there are multiple IP network segments, and some networks also require Intranet and Internet isolation. The following describes how to simulate a vro on a LINUX system and provides a reference for the brothers who have such requirements.
My description environment is: redhat 7.2 (2.4.7-10), 3com 3c509 Nic.
1 install redhat 7.2 Where the kernel is the linux-2.4.7-10
2. Download The vlansoftware package and set linux-2.4.7-10to vlan1.3.tar.gz.
3. Release the vlan software package in the/usr/src directory.
4 proc/usr/src/vlan Add vlan to linux kernel
5 cd/usr/src/linux-2.4.7-10 to configure the module make menuconfig of the kernel
6. Go to network configuration and select dot1q.
7. Compile kernel, make dep; make clean; make bzImage; make modules-install
8 cp/usr/src/linux-2.4.7-10 /... /boot/bzImage/boot/vmlinuz-2.4.7-10, cp/usr/src/linux-2.4.7-10 /... /system/boot/system-2.4.7-10
9 restart linux. during startup, You can see dot1q support by ben greear. The vlan has been started.
10 cd/usr/src/vlan: Compile the vconfig file. make. If you exit, check the location of the file called in vconfig. c.
11. Copy the vconfig executable file to/usr/sbin, cp/usr/src/vlan/vconfig/usr/sbin/vconfig.
12. Configure the vlan device. Take eth0 as an example. Set vconfig eth0 2 and vconfig eth0 3 to configure the IP address of vlan 1 on the master port.
13. Set an IP address on a vlan device. Ifconfig eth0.2 ipaddress netmask mask
14. Set the MAC address on the vlan device. Ifconfig eth0.2 MACaddress (use ifconfig for usage
Ifconfig -- help ).
15 configure the port connecting the router and linux to trunk. Take cisco 3548 as an example.
Interface fastethernet 0/48
Switchport trunk encapulation dot1q
16. Enable the ip forwarding function disabled by redhat by default. Echo "1">/proc/sys/net/ipv4/ip_forward
17. Test mutual access between devices in the same vlan and the sub-ports of the linux router. Test the mutual access between devices in different VLANs through the linux router.
All of the above are my practical experience. Please add the LINUXSIR label before COPY.
Related Article

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.