Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of Building Router in CentOS6 Environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The communication between networks mainly depends on routers. Of course, there are routers in the generation environment, but the routing configuration in the system also needs to be understood. Today, we will explain how to build routers in the CentOS6 environment. This is an entry-level simple experiment. The topology has been planned as shown in the figure above, so let's demonstrate using static routing for the time being.

Configuration

1. Configure all IP addresses first as shown in the figure

two。 Configure routing for different machines

Aubin-CentOS1

Route add default gw 10.0.1.1

CentOS-R1

Route add-net 10.0.3.0 24 gw 10.0.2.2route add-net 10.0.4.0Accord 24 gw 10.0.2.2echo 1 > / proc/sys/net/ipv4/ip_forward # enable forwarding (it can be understood as enabling routing) iptables-F # turn off the firewall

CentOS-R2

Route add-net 10.0.1.0 gw 10.0.2.1route add 24 gw 10.0.2.1route add-net 10.0.4.0 True 21 gw 10.0.3.1echo 1 > / proc/sys/net/ipv4/ip_forwardiptables-F

CentOS-R3

Route add-net 10.0.2.0 gw 10.0.3.2route add 24 gw 10.0.3.2route add-net 10.0.1.0 Universe 24 gw 10.0.3.2echo 1 > / proc/sys/net/ipv4/ip_forwardiptables-F

Aubin-CentOS1

Route add default gw 10.0.4.1

The above is all configured, and then tested with the CentOS1 area, the ip address of ping CentOS2 10.0.4.100. If ping is general, all configurations are fine. If there is no access, please participate in the exhibition and check at the following points

0. Although the configuration is simple, it is cumbersome enough. If you encounter problems, please check the following items patiently.

1. Use route-n to see if the route is valid.

2.cat / proc/sys/net/ipv4/ip_forward check whether the output is 1. If it is 0, the forwarding function is not enabled.

Check that echo 1 > / proc/sys/net/ipv4/ip_forward is executed successfully.

3. Check that the IP and mask are configured correctly, because there are multiple IP addresses that are easy to get confused, so check carefully.

4. Check to see if the firewall is turned off and execute iptables-F.

5. If you experiment in a virtual machine environment, check to see if the MAC address conflicts

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report