linux如何设置默认网关
linux添加设置默认网关步骤
第一步:使用xshell登录我们的linux服务器。

第二步:使用route -n查看本机的路由表,看到本机没有默认路由。

第三步:使用ip add查看本机地址,本机为192.168.101.2,设置规划的网关为192.168.101.254

第四步:手动增加一条路由。
route add default gw 192.168.101.254添加一条默认网关,然后route -n看到路由已经生效了

第五步:使用route add命令增加只是临时生效,重启会丢失,需要写入配置文件里边,按照如下配置可永久生效。
vim /etc/sysconfig/network
GATEWAY=192.168.101.254

【文章出处:抗攻击防御ddos http://www.558idc.com/krgf.html 复制请保留原URL】