NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# :-: 在已配置好网络情况下添加路由 | 适用范围 | 适用版本 | 人员 | 发布时间 | 文档版本 |备注 | | --- | --- | --- | --- | --- |--- | | 服务器操作系统 | V7、V10、V10-SP1 | 王承林 |2022.3.2| V1.0|发布| | 服务器操作系统 | V7、V10、V10-SP1 | 张志勇 |2022.3.2| V1.1|模板调整| ### 经测试,该方案有效可行 ***** 1. 查看所有con ``` [root@host1 ~]# nmcli connection show NAME UUID TYPE DEVICE bond0 1a4155d2-ad19-48b2-b003-19896389db2c bond bond0 ens160 fd43c970-fdb2-4032-9a76-c8bb3294d959 ethernet ens160 docker0 01b0ec95-bc35-4605-a881-52125a1cab0b bridge docker0 ens161 3425bd83-3ef1-4056-b8cd-8ef524948295 ethernet ens161 ``` 2. 选择路由出口,这里选中bond0 ![](https://img.kancloud.cn/ce/7f/ce7f0062519e8e888ce642f0a3dbe9b9_688x108.png) ``` 1. #路由规则为, 3.3.3.0/24 网络从bond0出去, 下一跳网关是3.3.3.3 nmcli connection modify bond0 +ipv4.routes "3.3.3.0/24 3.3.3.3" 2. #刷新网卡 [root@host1 ~]# nmcli connection up bond0 连接已成功激活(master waiting for slaves)(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/5) 3. #查看路由信息,发现3.3.3.0 已经添加, 下一跳是3.3.3.3 出口是bond0 [root@host1 ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 1.1.1.2 255.255.255.0 UG 300 0 0 bond0 1.1.1.0 0.0.0.0 255.255.255.0 U 300 0 0 bond0 1.1.1.0 1.1.1.2 255.255.255.0 UG 300 0 0 bond0 2.2.2.0 1.1.1.1 255.255.255.0 UG 300 0 0 bond0 3.3.3.0 3.3.3.3 255.255.255.0 UG 300 0 0 bond0 3.3.3.3 0.0.0.0 255.255.255.255 UH 300 0 0 bond0 172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 192.168.136.0 0.0.0.0 255.255.255.0 U 100 0 0 ens160 ```