网卡
-
网卡 - linux - 配置虚拟LO回环
- 用于响应请求处理
- 关闭网络配置管理器,避免网络接口冲突
systemctl stop NetworkManager
systemctl disable NetworkManager
- 切换到网卡配置文件目录: cd /etc/sysconfig/network-scripts
- 创建回环子配置文件:cp ifcfg-lo ifcfg-lo:1
- 配置回环子配置文件
DEVICE=lo:1
IPADDR=192.168.213.77
NETMASK=255.255.255.255
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
-
服务器配置arp(响应配置)
- arp配置参数
- arp-ignore:ARP响应的级别(处理请求)
- 0:只要本级配置了ip,就能响应请求
- 1:请求的目标地址到达对应的网络接口才会响应
- arp-announce:ARP通告行为(返回响应)
- 0:本机上任何网络接口都向外通告,所有的网卡都能接收到通告
- 1:尽量避免本网卡与不匹配的目标通告
- 2:至在本网卡通告
- arp-ignore:ARP响应的级别(处理请求)
- arp配置参数
- 编辑配置文件 vim /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
#所有入为1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.lo.arp_ignore = 1
#所有出为2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
- 刷新响应配置
- sysctl -p
- 把接收到的192.168.213.77数据报文让lo去响应
- route add -host 192.168.213.77 dev lo:1
- 配置为开机自动装配
- echo "route add -host 192.168.213.77 dev lo:1" >> /etc/rc.local
- 查看路由配置
- route -n
-
重启网络服务
- service network restart
- 查看ip配置
- ip addr
网卡
-
网卡 - linux - 配置虚拟LO回环
- 用于响应请求处理
- 关闭网络配置管理器,避免网络接口冲突
systemctl stop NetworkManager
systemctl disable NetworkManager
- 切换到网卡配置文件目录: cd /etc/sysconfig/network-scripts
- 创建回环子配置文件:cp ifcfg-lo ifcfg-lo:1
- 配置回环子配置文件
DEVICE=lo:1
IPADDR=192.168.213.77
NETMASK=255.255.255.255
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback
-
服务器配置arp(响应配置)
- arp配置参数
- arp-ignore:ARP响应的级别(处理请求)
- 0:只要本级配置了ip,就能响应请求
- 1:请求的目标地址到达对应的网络接口才会响应
- arp-announce:ARP通告行为(返回响应)
- 0:本机上任何网络接口都向外通告,所有的网卡都能接收到通告
- 1:尽量避免本网卡与不匹配的目标通告
- 2:至在本网卡通告
- arp-ignore:ARP响应的级别(处理请求)
- arp配置参数
- 编辑配置文件 vim /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
#所有入为1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.lo.arp_ignore = 1
#所有出为2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
- 刷新响应配置
- sysctl -p
- 把接收到的192.168.213.77数据报文让lo去响应
- route add -host 192.168.213.77 dev lo:1
- 配置为开机自动装配
- echo "route add -host 192.168.213.77 dev lo:1" >> /etc/rc.local
- 查看路由配置
- route -n
-
重启网络服务
- service network restart
- 查看ip配置
- ip addr