linux云服务器怎么配置网卡信息

  • 来源:网络
  • 更新日期:2022-02-15

摘要:【配置网卡信息】不把网卡设置好,则不能与其他机器进行通信网卡配置文件在/etc/sysconfig/network-scripts 里 ifcfg-eno16777736[root@happy network-scripts]# lsifcfg-eno

【配置网卡信息】不把网卡设置好,则不能与其他机器进行通信网卡配置文件在/etc/sysconfig/network-scripts 里 ifcfg-eno16777736[root@happy network-scripts]# lsifcfg-eno16777736 ifdown-ppp ifup-eth ifup-sitifcfg-lo ifdown-routes ifup-ippp ifup-Teamifdown ifdown-sit ifup-ipv6 ifup-TeamPortifdown-bnep ifdown-Team ifup-isdn ifup-tunnelifdown-eth ifdown-TeamPort ifup-plip ifup-wirelessifdown-ippp ifdown-tunnel ifup-plusb init.ipv6-globalifdown-ipv6 ifup ifup-post network-functionsifdown-isdn ifup-aliases ifup-ppp network-functions-ipv6ifdown-post ifup-bnep ifup-routes

网卡类型 TYPE=Ethernet地址分配模式 BOOTPROTO=static网卡名称 NAME= eno16777736是否启动 ONBOOT=yesIP地址 IPADDR=192.168.6.129子网掩码 NETMASK=255.255.255.0网关地址 GATEWAY=192.168.6.1DNS地址 DNS1=192.168.6.1

1、切换到网卡配置文件[root@happy ~]# cd /etc/sysconfig/network-scripts

2、配置网卡[root@happy network-scripts]# vim ifcfg-eno16777736HWADDR=00:0C:29:B3:64:C2TYPE=EthernetBOOTPROTO=staticDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_FAILURE_FATAL=noNAME=eno16777736UUID=f1d8f70c-1520-495b-8c1b-f830823d0611ONBOOT=yesIPADDR=192.168.6.129NETMASKE=255.255.255.0GATEWAY=192.168.6.1DNS1=192.168.6.1

3、重启网卡[root@happy network-scripts]# systemctl restart network

4、ping一下[root@happy network-scripts]# ping 192.168.6.129PING 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 ms64 bytes from 192.168.6.129: icmp_seq=2 ttl=64 time=0.070 ms64 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 1999msrtt min/avg/max/mdev = 0.045/0.055/0.070/0.012 ms配置成功