【配置网卡信息】

不把网卡设置好,则不能与其他机器进行通信

网卡配置文件在/etc/sysconfig/network-scripts 里 ifcfg-eno16777736

[root@happy network-scripts]# ls

ifcfg-eno16777736  ifdown-ppp       ifup-eth     ifup-sit

ifcfg-lo           ifdown-routes    ifup-ippp    ifup-Team

ifdown             ifdown-sit       ifup-ipv6    ifup-TeamPort

ifdown-bnep        ifdown-Team      ifup-isdn    ifup-tunnel

ifdown-eth         ifdown-TeamPort  ifup-plip    ifup-wireless

ifdown-ippp        ifdown-tunnel    ifup-plusb   init.ipv6-global

ifdown-ipv6        ifup             ifup-post    network-functions

ifdown-isdn        ifup-aliases     ifup-ppp     network-functions-ipv6

ifdown-post        ifup-bnep        ifup-routes

网卡类型     TYPE=Ethernet

地址分配模式 BOOTPROTO=static

网卡名称     NAME= eno16777736

是否启动     ONBOOT=yes

IP地址       IPADDR=192.168.6.129

子网掩码     NETMASK=255.255.255.0

网关地址     GATEWAY=192.168.6.1

DNS地址      DNS1=192.168.6.1

1、切换到网卡配置文件

[root@happy ~]# cd /etc/sysconfig/network-scripts

2、配置网卡

[root@happy network-scripts]# vim ifcfg-eno16777736

HWADDR=00:0C:29:B3:64:C2

TYPE=Ethernet

BOOTPROTO=static

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

NAME=eno16777736

UUID=f1d8f70c-1520-495b-8c1b-f830823d0611

ONBOOT=yes

IPADDR=192.168.6.129

NETMASKE=255.255.255.0

GATEWAY=192.168.6.1

DNS1=192.168.6.1

3、重启网卡

[root@happy network-scripts]# systemctl restart network

4、ping一下

[root@happy network-scripts]# ping 192.168.6.129

PING 192.168.6.129 (192.168.6.129) 56(84) bytes of data.

64 bytes from 192.168.6.129: icmp_seq=1 ttl=64 time=0.051 ms

64 bytes from 192.168.6.129: icmp_seq=2 ttl=64 time=0.070 ms

64 bytes from 192.168.6.129: icmp_seq=3 ttl=64 time=0.045 ms

^C

--- 192.168.6.129 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 1999ms

rtt min/avg/max/mdev = 0.045/0.055/0.070/0.012 ms

配置成功

Logo

更多推荐