在Red Hat AMI- 7.5上手动配置辅助Elastic网络接口 [英] Manually Configuring secondary Elastic network interface on Red hat ami- 7.5
问题描述
我真的很难在RHEL实例上手动配置ENI.我正在关注以下博客文章.
I am really having tough time manually configuring ENI on RHEL instance. I am following the following blogpost.
https://www.internetstaff.com/multiple-ec2-network-interfaces-on-red-hat-centos-7/#comment-11600
基于以上博客,有人可以帮我理解-
Based upon the above blog ,can someone please help me to understand --
- 如果我的vpc cidr是10.0.0.0/26,默认的vpc网关是10.0.0.1吗?
- 什么是子网网络掩码?是启动ENI的子网的IPV4 CIDR吗?
- 我是否必须在Rule-ethX的发件人"中提及在其中启动了ENI的子网的IPV4 CIDR?
如果还有其他更有效的方法,或者您知道任何其他在线资源,请告诉我.
If there is any other way to do it more efficiently or if you know of any other online source , please let me know.
推荐答案
这是手动配置Red Hat AMI的一种方法:
Here's one way to manually configure a Red Hat AMI:
DEVICE=eth1
BOOTPROTO=dhcp
ONBOOT=yes
IPADDR=10.xx.0.xx
NETMASK=255.255.255.xxx
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
PERSISTENT_DHCLIENT=yes
DEFROUTE=no
EC2SYNC=yes
添加这些路线.这里10.0.0.X是默认网关.在大多数情况下,它是EMI子网的第一个IP:
Add these routes. Here 10.0.0.X is the default gateway. Most times, it's the first IP of your EMI's subnet:
ip route add default via 10.0.0.x dev eth0 tab 1
ip route add default via 10.0.0.x dev eth1 tab 2
添加这些规则.这使用了ENI的IP:
Add these rules. This uses the ENI's IP:
ip rule add from 10.xx.0.xx/32 tab 1 priority 500
ip rule add from 10.xx.0.xx/32 tab 2 priority 600
运行ip rule show
.你应该得到这样的东西:
Run ip rule show
. You should get something like this:
# ip rule show
0: from all lookup local
500: from 10.xx.0.xx lookup 1
600: from 10.xx.0.xx lookup 2
32766: from all lookup main
32767: from all lookup default
请注意,这些路由和规则不会在重新启动后持续存在.
Note that these routes and rules will not persist across reboots.
这篇关于在Red Hat AMI- 7.5上手动配置辅助Elastic网络接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!