ubuntu 配置ip,dns,netmask,mac

来源:互联网 发布:御天降魔传 知乎 编辑:程序博客网 时间:2024/05/15 13:38
命令行配置ip、dns、netmask:
     ifconfig eth0 172.18.128.143 netmask 255.255.255.0 broadcast 172.18.128.255
     route add default gw 172.18.128.1
文本行配置ip、netmask:
    sudo vi /etc/network/interface
              auto lo
              iface lo inet loopback

              iface eth0 inet static
              address 172.18.128.143
              netmask 255.255.255.0
              gateway 172.18.128.1

              auto eth0
文本行配置dns:
    sudo vi /etc/resolv.conf
              nameserver 8.8.8.8

命令行配置mac地址:
    配置网卡的硬件地址 : ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

重新启动网络:
     sudo /etc/init.d/networking restart

启动网卡eth0
    sudo ifconfig eth0 up
关闭网卡eth0
    sudo ifconfig eth0 down
0 0
原创粉丝点击