DHCP服务器为不同网段的PC机动态分配IP地址

屏幕截图 2022-03-10 210520

SW1配置

#
vlan batch 10 20 30 #配置3个vlan ,vlan10 和vlan20用来连接PC ,vlan30用来连接路由器
#
dhcp enable #开启dhcp功能
#
interface Vlanif10 #配置vlanif接口地址
ip address 192.168.1.254 255.255.255.0
dhcp select relay #指定该接口为中继
dhcp relay server-ip 192.168.12.254 #指出dhcp server的地址
#
interface Vlanif20 #配置vlanif接口地址
ip address 192.168.2.254 255.255.255.0
dhcp select relay #指定该接口为中继
dhcp relay server-ip 192.168.12.254 #指出dhcp server的地址
#
interface Vlanif30 #配置vlanif接口地址
ip address 192.168.30.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10

#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20

#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 30

#
ip route-static 192.168.12.0 255.255.255.0 192.168.30.254

AR1配置

#
interface GigabitEthernet0/0/0
ip address 192.168.30.254 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.12.1 255.255.255.0
#
ip route-static 192.168.0.0 255.255.0.0 192.168.30.1

AR2配置

#
dhcp enable
#
ip pool vlan10 #建立地址池 vlan10是地址池名字,可以随意自定义
network 192.168.1.0 mask 255.255.255.0 #设置网段
gateway-list 192.168.1.254 #设置网关
dns-list 8.8.8.8 #设置dns
#
ip pool vlan20 #建立地址池 vlan20是地址池名字,可以随意自定义
network 192.168.2.0 mask 255.255.255.0 #设置网段
gateway-list 192.168.2.254 #设置网关
dns-list 114.114.114.114 #设置dns

#
interface GigabitEthernet0/0/0
ip address 192.168.12.254 255.255.255.0
dhcp select global #从地址池获取地址

#
ip route-static 192.168.0.0 255.255.0.0 192.168.12.1
ip route-static 192.168.30.0 255.255.255.0 192.168.12.1
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇