华为交换机配置DHCP, NAT, 互联vlan

eNSP 华为交换机配置DHCP, NAT, 互联vlan

Ⅰ: 网络拓扑图
华为交换机配置DHCP, NAT, 互联vlan_第1张图片
Ⅱ:配置部分
PC1-2-3-4: 地址获取选择DHCP
SW2:

sysname Huawei
undo info-center enable
vlan batch 10 20
#
interface Eth-Trunk0
 port link-type trunk
 port trunk allow-pass vlan 10 20
 #
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/1
 eth-trunk 0
interface GigabitEthernet0/0/2
 eth-trunk 0
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/4
 port link-type access
 port default vlan 20
 #
interface GigabitEthernet0/0/5
 eth-trunk 1
 #
interface GigabitEthernet0/0/6
 eth-trunk 1

SW3:

sysname Huawei
undo info-center enable
vlan batch 10 20
interface Eth-Trunk1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface Eth-Trunk2
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
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
 eth-trunk 2
#
interface GigabitEthernet0/0/4
 eth-trunk 2
#
interface GigabitEthernet0/0/5
 eth-trunk 1
#
interface GigabitEthernet0/0/6
 eth-trunk 1

SW1:

#
sysname Huawei
#
undo info-center enable
#
vlan batch 10 20 195
#
dhcp enable
#
ip pool 1
 gateway-list 192.168.1.1
 network 192.168.1.0 mask 255.255.255.0
 excluded-ip-address 192.168.1.200 192.168.1.254
 dns-list 8.8.8.8
#
ip pool 2
 gateway-list 192.168.2.1
 network 192.168.2.0 mask 255.255.255.0
 excluded-ip-address 192.168.2.200 192.168.2.254
 dns-list 8.8.8.8
#
interface Vlanif10
 ip address 192.168.1.1 255.255.255.0
 dhcp select global
#
interface Vlanif20
 ip address 192.168.2.1 255.255.255.0
 dhcp select global
#
interface Vlanif195
 ip address 195.1.1.1 255.255.255.0
#
interface Eth-Trunk0
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface Eth-Trunk2
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/1
 eth-trunk 0
#
interface GigabitEthernet0/0/2
 eth-trunk 0
#
interface GigabitEthernet0/0/3
 eth-trunk 2
#
interface GigabitEthernet0/0/4
 eth-trunk 2
#
interface GigabitEthernet0/0/5
 port link-type access
 port default vlan 195

AR3:

#
 undo info-center enable
#
acl number 2000  
 rule 5 permit source 192.168.1.0 0.0.0.255 
 rule 10 permit source 192.168.2.0 0.0.0.255 
#
 nat address-group 1 60.1.1.2 60.1.1.10
#
interface GigabitEthernet0/0/0
 ip address 195.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 60.1.1.1 255.255.255.0 
 nat outbound 2000 address-group 1 
 / nat outbound 2000 , 表示从该端口出,共用端口IP 地址//
 / nat static global 192.168.1.0 inside 60.1.1.1 , 静态端口配置///
#
interface NULL0
#
ip route-static 192.168.1.0 255.255.255.0 195.1.1.1
ip route-static 192.168.2.0 255.255.255.0 195.1.1.1
#

R3:

#
sysname Huawei
#
undo info-center enable
#
interface Ethernet0/0/0
 ip address 60.1.1.100 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 60.1.1.1
#

Ⅲ 验证部分:
PC1:

ping 60.1.1.100
Ping 60.1.1.100: 32 data bytes, Press Ctrl_C to break
From 60.1.1.100: bytes=32 seq=1 ttl=253 time=203 ms
From 60.1.1.100: bytes=32 seq=2 ttl=253 time=62 ms
From 60.1.1.100: bytes=32 seq=3 ttl=253 time=94 ms
From 60.1.1.100: bytes=32 seq=4 ttl=253 time=94 ms
From 60.1.1.100: bytes=32 seq=5 ttl=253 time=93 ms
--- 60.1.1.100 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 62/109/203 ms

R3:

[Huawei]ping 192.168.2.199
  PING 192.168.2.199: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.199: bytes=56 Sequence=1 ttl=126 time=130 ms
    Reply from 192.168.2.199: bytes=56 Sequence=2 ttl=126 time=90 ms
    Reply from 192.168.2.199: bytes=56 Sequence=3 ttl=126 time=110 ms
    Reply from 192.168.2.199: bytes=56 Sequence=4 ttl=126 time=90 ms
    Reply from 192.168.2.199: bytes=56 Sequence=5 ttl=126 time=90 ms

你可能感兴趣的:(交换机,dhcp)