1.查看网卡名,确定需要配置的目标网卡
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether d8:9e:f3:35:c3:66 brd ff:ff:ff:ff:ff:ff
inet 10.1.9.50/24 brd 10.1.9.255 scope global enp0s25
valid_lft forever preferred_lft forever
inet6 2001:da8:a012:2da:f3c5:dc14:1316:2268/64 scope global noprefixroute dynamic
valid_lft 2591982sec preferred_lft 604782sec
inet6 fe80::e49c:f19c:2e03:e014/64 scope link
valid_lft forever preferred_lft forever
3: enp8s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether d8:9e:f3:35:c3:74 brd ff:ff:ff:ff:ff:ff
2.对指定网卡enp0s25
设置固定IP
sudo vim /etc/network/interfaces
auto enp0s25 # 设置自动启动enp0s25接口
iface enp0s25 inet static # 配置静态IP
address 10.1.9.67 # IP地址
netmask 255.255.255.0 # 子网掩码
gateway 10.1.9.1 # 网关
3.重启网络
sudo /etc/init.d/networking restart
参考资料
- ubuntu 查看网卡的网关_Ubuntu系统怎么设置静态ip?同样适用于深度系统的教程
- Ubuntu系统设置静态IP
评论 (0)