Linux多网卡多IP配置记录
2018-04-16 01:52
537 查看
腾讯云的机器,加了一块弹性网卡,记录下配置:
修改成:
配置文件目录
cd /etc/sysconfig/network-scripts/
主网卡配置
cat ifcfg-eth0
# Created by cloud-init on instance boot automatically, do not edit. # BOOTPROTO=none DEFROUTE=yes DEVICE=eth0 GATEWAY=172.16.0.1 HWADDR=52:54:00:48:4b:1c IPADDR=172.16.0.8 NETMASK=255.255.240.0 NM_CONTROLLED=no ONBOOT=yes TYPE=Ethernet USERCTL=no
副网卡配置
cat ifcfg-eth1
# edited by Luke. # BOOTPROTO=static # DEFROUTE=yes DEVICE=eth1 GATEWAY=172.16.0.1 # HWADDR=52:54:00:48:4b:1c IPADDR=172.16.0.16 NETMASK=255.255.240.0 NM_CONTROLLED=no ONBOOT=yes TYPE=Ethernet #USERCTL=no
关闭 rp_filter 校验
vim /etc/sysctl.conf
net.ipv4.conf.default.rp_filter = 1
修改成:
net.ipv4.conf.default.rp_filter = 0 net.ipv4.conf.all.rp_filter = 0 net.ipv4.conf.eth0.rp_filter = 0 net.ipv4.conf.eth1.rp_filter = 0
其他IP配置
cat ifcfg-eth0:0
BOOTPROTO=static DEVICE=eth0:0 IPADDR=172.16.0.10 NETMASK=255.255.240.0 ONBOOT=yes
重启网络&测试
systemctl restart network ip addr curl --interface eth0 ip.sb curl --interface eth1 ip.sb curl --interface eth0:0 ip.sb curl --interface eth0:1 ip.sb
相关文章推荐
- Linux配置网卡IP【记录下加深记忆】
- linux学习工作记录----配置基于ip的虚拟主机
- linux 下 安装网卡驱动 及配置IP
- linux下多网卡配置同网段IP的问题以及解决方法
- linux下一个网卡配置多个IP
- Linux下配置网卡ip别名
- Shell脚本实现动态配置IP与路由:解决嵌入式Android/Linux有线和无线网卡双网共存问题
- RedHat 6 下配置网卡IP地址,Virtual Linux下配置网卡IP
- CentOS6.7网卡配置及常见问题(linux ip配置)
- Linux多网卡多IP配置
- RedHat 6 下配置网卡IP地址,Virtual Linux下配置网卡IP
- Linux单个网卡配置多个IP
- linux多IP(网卡)配置
- Linux 下配置网卡的别名即网卡子IP的配置
- linux为网卡批量配置连续IP
- Linux 服务器网卡 IP 配置
- Linux 配置ip 子接口 多网卡绑定
- linux下一个网卡配置多个ip
- RedHat 6 下配置网卡IP地址,Virtual Linux下配置网卡IP
- Linux:解决配置静态ip后eth0网卡启动不了的问题