RHEL在VLAN Trunk模式下的IP地址配置

今天拿到客户两笼刀片机,进行RHEL6U3系统的安装操作,打算安装完第一台刀片之后,将其配置成KICKSTART服务器对其他刀片进行网络安装。

相关阅读

RHEL网络安装刀片服务器 

然而,安装完第一片刀之后,对其进行IP的设置。

1. 首先查看有多少个网卡
[root@blog01 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> 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 forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:6a brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:68 brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:6c brd ff:ff:ff:ff:ff:ff
6: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:69 brd ff:ff:ff:ff:ff:ff
7: eth5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:6d brd ff:ff:ff:ff:ff:ff
8: eth6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:6e brd ff:ff:ff:ff:ff:ff
9: eth7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 38:ea:a7:a1:fd:72 brd ff:ff:ff:ff:ff:ff


2. 查看哪些网卡是连接正常的
[root@blog01 ~]# for i  in `seq 0 7`
> do
> res=`ethtool eth$i |grep Link |awk -F: '{print $2}'`
> echo "eth$i  Link $res"
> done
eth0  Link  yes
eth1  Link  yes
eth2  Link  no
eth3  Link  no
eth4  Link  no
eth5  Link  no
eth6  Link  no
eth7  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.254
PING 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 ms
64 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 1002ms
rtt 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-eth0
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
[root@blog01 ~]#cat /etc/sysconfig/network-scripts/ifcfg-eth0.528
DEVICE=eth0.528
ONBOOT=yes
BOOTPROTO=none
VLAN=yes
TYPE=Ethernet
BRIDGE=br0
[root@blog01 ~]#cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
TYPE=Bridge
IPADDR=10.196.28.43
NETMASK=255.255.255.0
GATEWAY=10.196.28.254

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/20abda01759d60ef76acb85e622fafd8.html