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 adding Route under ​ linux

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

One: use the route command to add

The route added using the route command becomes invalid after the machine is rebooted or the network card is restarted. Method:

/ / routes added to the host # route add-host 192.168.168.110 dev eth0# route add-host 192.168.168.119 gw 192.168.168.1Accord / routes added to the network # route add-net IP netmask MASK eth0# route add-net IP netmask MASK gw IP# route add-net IP/24 eth2// add default gateway # route add default gw IP// delete route # route del-host 192.168.168.110 dev eth0

Second: the method of setting permanent route under linux:

1. Add to / etc/rc.local

Methods:

Route add-net 192.168.3.0 dev eth0route add 24 dev eth0route add-net 192.168.2.0 Universe 24 gw 192.168.3.254

two。 Add to the end in / etc/sysconfig/network

Method: GATEWAY=gw-ip or GATEWAY=gw-dev

3./etc/sysconfig/static-router:

Any net x.x.x.x/24 gw y.y.y.y

Linux add permanent static rout

Routing functions of Linux:

# the route added by the route command is not lost after the machine is rebooted or the network card is rebooted. How to set a permanent route under linux:

1. Add to / etc/rc.local

two。 Add to the end in / etc/sysconfig/network

3./etc/sysconfig/static-router:

Any net x.x.x.x/24 gw y.y.y.y

Enable IP forwarding:

# echo "1" > / proc/sys/net/ipv4/ip_forward (temporary) # vi / etc/sysctl.conf-> net.ipv4.ip_forward=1 (permanently open)

These are the details of how to add routing to linux. Please pay more attention to other related articles!

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