加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

redhat – 通过DHCP进行Linux静态路由配置

发布时间:2020-12-14 02:28:56 所属栏目:Linux 来源:网络整理
导读:我有一堆RedHat虚拟机,我需要设置静态IPv4路由表.我想集中这个配置,我想到了可以提供这些信息的DHCP服务(参见RFC3442). RHEL 5和RHEL6附带的任何DHCP客户端 支持此功能? 还有其他替代方法来进行路由表配置吗? 切换到IPv6会简化这种配置吗? 欢迎任何其他想
我有一堆RedHat虚拟机,我需要设置静态IPv4路由表.我想集中这个配置,我想到了可以提供这些信息的DHCP服务(参见RFC3442).

> RHEL 5和RHEL6附带的任何DHCP客户端
支持此功能?
>还有其他替代方法来进行路由表配置吗?
>切换到IPv6会简化这种配置吗?

欢迎任何其他想法.

见:RFC3442 – Classless Static Route Option for DHCPv4

解决方法

您是否考虑通过Puppet或Chef处理此事?我认为编写一个模块可以相当容易,该模块将检查以确保路由存在并在它们不可用时应用它们.这为您提供了与单个DHCP服务配置文件相同的灵活性和集中控制.

如果使用静态IP设置VM,则可以在网络接口的路由配置文件中设置该文件,例如’/ etc / sysconfig / network-scripts / route-eth0′.这也可以通过配置管理工具轻松管理.

如果您希望通过DHCP执行此操作,请确保根据RedHat知识库文章(https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.1_Technical_Notes/ar01s04s05.html)正确配置了DHCP客户端

To ensure that RFC3442-standard classless static routes provided by a
DHCP server are processed correctly when using NetworkManager,the
following lines should be placed into /etc/dhclient.conf or,if using
per-interface DHCP options,/etc/dhclient-<ifname>.conf:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8; 
option ms-classless-static-routes code 249 = array of unsigned integer 8; 
also request rfc3442-classless-static-routes;
also request ms-classless-static-routes;

These lines will ensure that RFC3442 classless static routes are requested from the DHCP server,and that they are properly processed by NetworkManager.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读