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

ubuntu系统中:

ifconfig

enp2s0: flags=4163  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  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        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
 

 

你可能感兴趣的:(Linux技能汇总)