本文共 5177 字,大约阅读时间需要 17 分钟。
今天拿到客户两笼刀片机,进行RHEL6U3系统的安装操作,打算安装完第一台刀片之后,将其配置成KICKSTART服务器对其他刀片进行网络安装。
然而,安装完第一片刀之后,对其进行IP的设置。
1. 首先查看有多少个网卡
[root@blog01 ~]# ip a1: lo:2. 查看哪些网卡是连接正常的mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc mq state UP qlen 1000 link/ether 38:ea:a7:a1:fd:66 brd ff:ff:ff:ff:ff:ff inet6 fe80::3aea:a7ff:fea1:fd66/64 scope link valid_lft forever preferred_lft forever3: eth1: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:6a brd ff:ff:ff:ff:ff:ff4: eth2: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:68 brd ff:ff:ff:ff:ff:ff5: eth3: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:6c brd ff:ff:ff:ff:ff:ff6: eth4: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:69 brd ff:ff:ff:ff:ff:ff7: eth5: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:6d brd ff:ff:ff:ff:ff:ff8: eth6: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:6e brd ff:ff:ff:ff:ff:ff9: eth7: mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 38:ea:a7:a1:fd:72 brd ff:ff:ff:ff:ff:ff
[root@blog01 ~]# for i in `seq 0 7`> do> res=`ethtool eth$i |grep Link |awk -F: '{print $2}'`> echo "eth$i Link $res"> doneeth0 Link yeseth1 Link yeseth2 Link noeth3 Link noeth4 Link noeth5 Link noeth6 Link noeth7 Link no
3. 可以看出eth0,eth1是连接成功的
4. 对eth0配置IP地址
从客户获得的IP设置范围是10.196.28.0/24 ,该网段端口被设置成了Trunk模式。
5.手动将eth0加入vlan id为528的VLAN,并配置IP
[root@blog01 ~]# vconfig add eth0 528[root@blog01 ~]# ifconfig eth0.528 10.196.28.43 netmask 255.255.255.0[root@blog01 ~]# ping -W1 -c2 10.196.28.254PING 10.196.28.254 (10.196.28.254) 56(84) bytes of data.64 bytes from 10.196.28.254: icmp_seq=1 ttl=255 time=1.14 ms64 bytes from 10.196.28.254: icmp_seq=2 ttl=255 time=1.15 ms--- 10.196.28.254 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1002msrtt min/avg/max/mdev = 1.149/1.154/1.159/0.005 ms
6.写入网卡配置文件
为了使得系统重启后,IP配置仍旧生效,写入系统配置文件
另外本机需要作为KVM虚拟化平台,故需要创建桥接设备br0
[root@blog01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0ONBOOT=yesTYPE=EthernetBOOTPROTO=none[root@blog01 ~]#cat /etc/sysconfig/network-scripts/ifcfg-eth0.528DEVICE=eth0.528ONBOOT=yesBOOTPROTO=noneVLAN=yesTYPE=EthernetBRIDGE=br0[root@blog01 ~]#cat /etc/sysconfig/network-scripts/ifcfg-br0DEVICE=br0ONBOOT=yesBOOTPROTO=noneTYPE=BridgeIPADDR=10.196.28.43NETMASK=255.255.255.0GATEWAY=10.196.28.254
7.重新启动网络服务,查看最终网卡配置信息
[root@blog01 ~ ]# service network restart[root@blog01 ~]# cat /proc/net/vlan/configVLAN Dev name | VLAN IDName-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PADeth0.528 | 528 | eth0[root@SJC42KVM01 ~]# brctl showbridge name bridge id STP enabled interfacesbr0 8000.38eaa7a1fd66 no eth0.528[root@SJC42KVM01 ~]# ifconfig eth0eth0 Link encap:Ethernet HWaddr 38:EA:A7:A1:FD:66 inet6 addr: fe80::3aea:a7ff:fea1:fd66/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:14600981 errors:0 dropped:0 overruns:0 frame:0 TX packets:16880 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1175506152 (1.0 GiB) TX bytes:4080056 (3.8 MiB)[root@blog01 ~]# ifconfig eth0.528eth0.528 Link encap:Ethernet HWaddr 38:EA:A7:A1:FD:66 inet6 addr: fe80::3aea:a7ff:fea1:fd66/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:600 errors:0 dropped:0 overruns:0 frame:0 TX packets:313 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:66715 (65.1 KiB) TX bytes:57925 (56.5 KiB)[root@blog01 ~]# ifconfig br0br0 Link encap:Ethernet HWaddr 38:EA:A7:A1:FD:66 inet addr:10.196.28.43 Bcast:10.196.28.255 Mask:255.255.255.0 inet6 addr: fe80::3aea:a7ff:fea1:fd66/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:549 errors:0 dropped:0 overruns:0 frame:0 TX packets:345 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:63581 (62.0 KiB) TX bytes:64296 (62.7 KiB)
8.测试网络连接是否通畅
[root@blog01 ~]# ping -W1 -c2 10.196.28.254PING 10.196.28.254 (10.196.28.254) 56(84) bytes of data.64 bytes from 10.196.28.254: icmp_seq=1 ttl=255 time=1.31 ms64 bytes from 10.196.28.254: icmp_seq=2 ttl=255 time=0.907 ms--- 10.196.28.254 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1002msrtt min/avg/max/mdev = 0.907/1.108/1.310/0.204 ms[root@blog01 ~]# ping -W1 -c2 10.192.28.254PING 10.192.28.254 (10.192.28.254) 56(84) bytes of data.64 bytes from 10.192.28.254: icmp_seq=1 ttl=249 time=2.63 ms64 bytes from 10.192.28.254: icmp_seq=2 ttl=249 time=2.78 ms--- 10.192.28.254 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1004msrtt min/avg/max/mdev = 2.635/2.709/2.784/0.090 ms
配置完成!
转载地址:http://vjbul.baihongyu.com/