ubuntu让/etc/hosts修改后立刻生效

ubuntu系统中:

ifconfig

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.103  netmask 255.255.255.0  broadcast 192.168.0.255
        ether 74:d4:35:2e:da:c0  txqueuelen 1000  (Ethernet)
        RX packets 856767  bytes 962251105 (962.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 673791  bytes 92635286 (92.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 99682  bytes 25803522 (25.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 99682  bytes 25803522 (25.8 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

可以看到电脑连接的是无线网enp2s0

那么生效命令如下:

# ifconfig enp2s0 down
# ifconfig enp2s0 up
 

 

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页