ubuntu修改ip获取方式,静态,动态

1、直接修改系统配置文件
  ubuntu的网络配置文件是:/etc/network/interfaces

  a、动态ip方式

  auto eth0
  iface eth0 inet dhcp
  用下面的命令使网络设置生效:
  sudo /etc/init.d/networking restart

  b、静态ip方式

  auto eth0
  iface eth0 inet static
  address 192.168.1.22
  gateway 192.168.1.1
  netmask 255.255.255.0
  #network 192.168.1.0
  #broadcast 192.168.1.255

  将上面的ip地址等信息换成你自己就可以了.用下面的命令使网络设置生效:
  sudo /etc/init.d/networking restart