ubuntu系统修改网卡ip

需求:将ubuntu系统ens33网卡ip修改为192.168.244.140


1.编辑/etc/network/interfaces文件

1
2
3
4
5
6
7
8
9
10
11
meichaofan@ubuntu:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

# 新增内容
auto ens33
iface ens33 inet static
address 192.168.244.140
netmask 255.255.255.0
gateway 192.168.244.2

2.重启网卡

1
sudo /etc/init.d/networking restart