Get the App
SLTechnology News&Howtos  ›  Development  › 

How to build a Router in CentOS6 Environment

Shulou Source: shulou.com Published: 2022-05-31 22:35:08 09月21日 Update

This article mainly introduces the relevant knowledge of "how to build a router in the CentOS6 environment". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to build a router in the CentOS6 environment" can help you solve the problem.

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 off and execute iptables-f.

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

This is the end of the introduction on "how to build a router in CentOS6". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Check configure route environment address router function knowledge problem different industry firewall fire prevention utility success tedious patient content multiple practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info macOS Docker Xiaomi MySQL