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

Example Analysis of routing and default Gateway configuration in CentOS basic Network

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail the example analysis of CentOS basic network configuration routing and default gateway. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

First, view routes

Enter on the command line

Netstat-r

Or

Route

Command to view the routes that are working in the system

Second, add routing

(1) enter on the command line

Route add-net 192.168.0.0amp 16 gw 10.1.1.254

This method becomes invalid after the system is restarted. Add this line in rc.local.

(2) set the system default gateway in the / etc/sysconfig/network file

GATEWAY=192.168.0.1

(3) set different default gateways for a single Nic / etc/sysconfig/network-scripts/ifcfg-eth0

GATEWAY=192.168.0.1

(4) set multiple routed networks / etc/sysconfig/network-scripts/eth0.route for a single Nic

ADDRESS0=192.168.0.0

NETMASK0=255.255.0.0

GATEWAY0=10.1.1.254

ADDRESS1=172.16.0.0

NETMASK1=255.240.0.0

GATEWAY1=10.1.1.254

Entry into force of changes to the file

Method (2) the system network service needs to be restarted

Service network restart

Method (3) (4) restart a single network card

Ifdown eth0 & & ifup eth0

This is the end of the article on "sample Analysis of routing and default Gateway in CentOS basic Network configuration". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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