- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務(wù)經(jīng)營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認(rèn)證網(wǎng)站身份V標(biāo)記
- 域名注冊服務(wù)機(jī)構(gòu)許可:滇D3-20230001
- 代理域名注冊服務(wù)機(jī)構(gòu):新網(wǎng)數(shù)碼
一,默認(rèn)在系統(tǒng)中添加的路由會隨著網(wǎng)絡(luò)重新啟動丟失
[root@vm-al-bj2-web01 ~]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.7.254 0.0.0.0 UG 100 0 0 ens192192.168.0.0 0.0.0.0 255.255.248.0 U 100 0 0 ens192
二,添加網(wǎng)絡(luò)路由
[root@vm-al-bj2-web01 ~]# route add -net 192.168.13.0 netmask 255.255.255.0 gw 192.168.7.254[root@vm-al-bj2-web01 ~]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.7.254 0.0.0.0 UG 100 0 0 ens192192.168.0.0 0.0.0.0 255.255.248.0 U 100 0 0 ens192192.168.13.0 192.168.7.254 255.255.255.0 UG 0 0 0 ens192[root@vm-al-bj2-web01 ~]# systemctl restart network[root@vm-al-bj2-web01 ~]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.7.254 0.0.0.0 UG 100 0 0 ens192192.168.0.0 0.0.0.0 255.255.248.0 U 100 0 0 ens192[root@vm-al-bj2-web01 ~]#
三,添加永久網(wǎng)絡(luò)路由(route-ens192是網(wǎng)卡,建議跟隨網(wǎng)卡名)
[root@vm-al-bj2-web01 ~]# vim /etc/sysconfig/network-scripts/route-ens192ADDRESS0=192.168.13.0NETMASK0=255.255.255.0GATEWAY0=192.168.7.254
四,驗(yàn)證
[root@vm-al-bj2-web01 ~]# systemctl restart network[root@vm-al-bj2-web01 ~]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.7.254 0.0.0.0 UG 100 0 0 ens192192.168.0.0 0.0.0.0 255.255.248.0 U 100 0 0 ens192192.168.13.0 192.168.7.254 255.255.255.0 UG 100 0 0 ens192
注意:
1.ADDRESS后面是數(shù)字0表示第一條有多條路由就是0,1,2,3依次
2.這種方法只是其中之一,放入/etc/rc.local亦可。
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP