当前位置: 代码迷 >> 综合 >> linux更改机器名localhost及启动停掉网卡
  详细解决方案

linux更改机器名localhost及启动停掉网卡

热度:44   发布时间:2023-09-20 11:54:54.0

1.hostname test 命令模式更改,重启后不生效

在/etc/sysconfig/network中修改

sed -i 's#localhost.localdomain#test#g'   /etc/sysconfig/network

2./etc/init.d/network start    ifup  etho启动网卡   ifdown  eth0停掉网卡

3.route -n  查看路由,最后一行为网关

route del default gw 10.0.0.254删除默认网关

route add default gw 10.0.0.254添加默认网关