部署LVS-DR集群ip和MAC设置

查看ip

 

ip addr  

ip addr ls dev eth0

 

添加ip地址:(一张网卡有两个网卡)

[root@rs1 ~]# ip addr add dev eth0 192.168.5.11/24(//如果不加/24 ,就默认32)

[root@rs1 ~]# ip addr ls dev eth0

2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 52:54:00:d9:8c:eb brd ff:ff:ff:ff:ff:ff

    inet 192.168.4.11/24 brd 192.168.4.255 scope global eth0

       valid_lft forever preferred_lft forever

    inet 192.168.5.11/24 scope global eth0

       valid_lft forever preferred_lft forever

    inet6 fe80::bf84:1b63:f68:8c45/64 scope link 

       valid_lft forever preferred_lft forever

 

删除ip地址:

[root@rs1 ~]# ip addr del dev eth0 192.168.5.11/24

[root@rs1 ~]# ip addr ls dev eth0

2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 52:54:00:d9:8c:eb brd ff:ff:ff:ff:ff:ff

    inet 192.168.4.11/24 brd 192.168.4.255 scope global eth0

       valid_lft forever preferred_lft forever

    inet6 fe80::bf84:1b63:f68:8c45/64 scope link 

       valid_lft forever preferred_lft forever

 

查看MAC地址:(查看链路层的信息)

[root@rs1 ~]# ip linke

[root@rs1 ~]# ip link help

 

添加一个虚拟的网络设备:(这个网络设备就是要添加一对)(添加完就是相当于一条网线)

[root@rs1 ~]# ip link  add veth-a  type veth peer veth-b

 

为虚拟网卡添加ip地址:

[root@rs1 ~]# ip addr add dev veth-a  192.168.4.101/24

 

客户机检测:

[root@ds1 ~]# ping -c 3 192.168.4.101

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

64 bytes from 192.168.4.101: icmp_seq=1 ttl=64 time=0.855 ms

64 bytes from 192.168.4.101: icmp_seq=2 ttl=64 time=0.370 ms

 

给虚拟网卡,进行静言。(把功能禁用,忽略arp请求应答)

让eth0网卡不对arp请求做应答:

[root@rs1 ~]# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore

[root@rs1 ~]# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

 

客户端测试:

[root@ds1 ~]# ping -c 3 192.168.4.101

[root@ds1 ~]# arp -d 192.168.4.101  //要删除缓存(删除arp缓存表条目)

[root@ds1 ~]# ping -c 3 192.168.4.101

 

再次查看MAC地址表: 192.168.4.101 没有MAC地址

[root@ds1 ~]# arp -n

Address                  HWtype  HWaddress           Flags Mask            Iface

192.168.4.101                    (incomplete)                              eth0

192.168.4.11             ether   52:54:00:d9:8c:eb   C                     eth0

201.1.1.254              ether   52:54:00:88:2b:9c   C                     eth2

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(集群技术)