redhat 6 红帽6 Linux 网络配置

时间:2022-05-22 17:38:55

[root@ORAMYSQL ~]# cd /etc/sysconfig/network-scripts/ 切换到网卡配置目录
[root@ORAMYSQL network-scripts]# vi ifcfg-eth0 #编辑eth0网卡的内容

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 #网卡设备名称
ONBOOT=yes #启动时是否激活 yes | no
BOOTPROTO=static #协议类型 dhcp bootp none
IPADDR=192.168.1.90 #网络IP地址
NETMASK=255.255.255.0 #网络子网地址
GATEWAY=192.168.1.1 #网关地址
BROADCAST=192.168.1.255 #广播地址
HWADDR=00:0C:29:FE:1A:09 #网卡MAC地址
TYPE=Ethernet #网卡类型为以太网
DNS1=8.8.8.8 #配置dns

[root@ORAMYSQL network-scripts]# service network restart
[root@ORAMYSQL network-scripts]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:5A:92:16
inet addr:192.168.89.18 Bcast:192.168.89.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe5a:9216/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:862 errors:0 dropped:0 overruns:0 frame:0
TX packets:304 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:67779 (66.1 KiB) TX bytes:39287 (38.3 KiB)