Fedora设置静态ip地址

1、打开/etc/sysconfig/network-scripts/目录下名为enp0s3或eth0的网络配置文件。

HWADDR=08:00:27:54:BB:64
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=9957d398-c9c5-38a1-8a6e-8b70091b7ff7
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999

2、修改

HWADDR=08:00:27:54:BB:64
TYPE=Ethernet
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.9.68
NETMASK=255.255.255.0
GATEWAY=192.168.9.1
DNS1=172.16.10.8
DNS2=8.8.8.8

DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=9957d398-c9c5-38a1-8a6e-8b70091b7ff7
ONBOOT=yes

3、重启网络服务

service network restart

或者直接点击界面操作

4、虚拟机里要设置为桥接网卡


你可能感兴趣的:(Linux)