Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCP Relay Solution 引起的一个”双网卡环境下添加一条静态路由问题“ #13

Open
todaygood opened this issue Jan 3, 2019 · 2 comments

Comments

@todaygood
Copy link
Owner

todaygood commented Jan 3, 2019

场景

使用dhcp relay , 原理可参见

http://www.ruijie.com.cn/fw/wt/36563/
http://network.51cto.com/art/201103/248245.htm

也就是说: dhcp server (192.168.1.0/24) 分配一个 10.1.1.0/24 的IP 给客户端, 因为网络不通,所以需要在switch上面做一个dhcp relay。

在我这个问题场景下, 交换机配置如下
image

dhcp server 在我们的场景下面是一个双网卡的机器, 默认路由并不在192.168.X 这个IP 上面

image

@todaygood todaygood changed the title 双网卡环境下添加一条静态路由带来的思考 DHCP Relay Solution 引起的一个”双网卡环境下添加一条静态路由问题“ Jan 3, 2019
@todaygood
Copy link
Owner Author

不需要在各个用户网关设备上启用DHCP server功能,而只要在网络中心安装一个
DHCP 服务器,就可以实现对多个网段的动态IP管理,统一维护,即Client—Relay—Server 模式的DHCP动态IP管理

@todaygood
Copy link
Owner Author

需求

双网卡环境下添加一条静态路由
[root@centos1 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.172.2 0.0.0.0 UG 0 0 0 cloudbr0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 ens38
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
192.168.172.0 0.0.0.0 255.255.255.0 U 0 0 0 cloudbr0

其中Gateway显示为0.0.0.0的路由,为本机网络,不需要路由

[root@centos1 ~]# ip r
default via 192.168.172.2 dev cloudbr0
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.1.0/24 dev ens38 proto kernel scope link src 192.168.1.5
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
192.168.172.0/24 dev cloudbr0 proto kernel scope link src 192.168.172.132
[root@centos1 ~]# ip r a 192.168.122.0/24 via 192.168.122.254
RTNETLINK answers: File exists
报错,说已经有这条路由了, 可以使用ip r change命令

[root@centos1 ~]# ip r c 192.168.122.0/24 via 192.168.122.2
[root@centos1 ~]# ip r
default via 192.168.172.2 dev cloudbr0 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 
192.168.1.0/24 dev ens38 proto kernel scope link src 192.168.1.5 
192.168.122.0/24 via 192.168.122.2 dev virbr0 
192.168.172.0/24 dev cloudbr0 proto kernel scope link src 192.168.172.132 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant