1+x云计算中级,串讲第二天的内容为利用ensp模拟华为设备
拓扑图如下
需要达到的效果:网络互通,各个vlan之间能正常通信,三个PC机能通过dhcp获得地址,能够通过cloud连接到外网,ping通8.8.8.8
需要用的技术有,vlan划分,OSPF,静态路由,路由的重发布,nat,基于端口的dhcp技术,cloud的使用
#
sysname sw1
#
vlan batch 5
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type access
port default vlan 5
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
4.sw2的配置
划分vlan10,并将和PC连接的接口模式切换为access模式,将vlan10和此端口进行绑定,将与三层交换机连接的接口模式切换为trunk模式,并且允许所有vlan通过
#
sysname s2
#
vlan batch 10
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type access
port default vlan 10
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
5.sw3的配置
划分vlan15,并将和PC连接的接口模式切换为access模式,将vlan15和此端口进行绑定,将与三层交换机连接的接口模式切换为trunk模式,并且允许所有vlan通过
#
sysname s3
#
vlan batch 15
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type access
port default vlan 15
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
6.sw4的配置
划分vlan5、10、20,给vlan5、10、20分别给地址,将二层交换机连接的两个接口模式切换为trunk模式,并且允许所有所有vlan通过。将与路由器连接的接口模式切换为access模式,将接口与vlan20进行绑定。建立两个地址池,使用ip pool 名称
命令,建立一个名为5,一个名为10的地址池,利用dhcp enable
命令开启dhcp功能,在vlan5和vlan10中利用dhcp select global
开启基于vlan的dhcp,此时就可以在下面连接的pc机上得到地址。
通过动态路由osfp将自身有的网段宣告出去,配置至此结束。
#
sysname s4
#
vlan batch 5 10 20
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
dhcp enable
#
diffserv domain default
#
drop-profile default
#
ip pool 5
gateway-list 192.168.1.1
network 192.168.1.0 mask 255.255.255.0
dns-list 8.8.8.8
#
ip pool 10
gateway-list 192.168.2.1
network 192.168.2.0 mask 255.255.255.0
dns-list 8.8.8.8
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface Vlanif5
ip address 192.168.1.1 255.255.255.0
dhcp select global
#
interface Vlanif10
ip address 192.168.2.1 255.255.255.0
dhcp select global
#
interface Vlanif20
ip address 192.168.4.1 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 192.168.4.0 0.0.0.255
#
user-interface con 0
user-interface vty 0 4
#
return
7.sw5的配置
划分vlan15、25,给vlan15、25分别给地址,将二层交换机连接的两个接口模式切换为trunk模式,并且允许所有所有vlan通过。将与路由器连接的接口模式切换为access模式,将接口与vlan25进行绑定。建立一个地址池,使用ip pool 名称
命令,建立一个名为15地址池,利用dhcp enable
命令开启dhcp功能,在vlan15中利用dhcp select global
开启基于vlan的dhcp,此时就可以在下面连接的pc机上得到地址。
通过动态路由osfp将自身有的网段宣告出去,配置至此结束。
#
sysname s5
#
vlan batch 15 25
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
dhcp enable
#
diffserv domain default
#
drop-profile default
#
ip pool 15
gateway-list 192.168.3.1
network 192.168.3.0 mask 255.255.255.0
dns-list 8.8.8.8
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface Vlanif15
ip address 192.168.3.1 255.255.255.0
dhcp select global
#
interface Vlanif25
ip address 192.168.6.2 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 25
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
ospf 1
area 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.6.0 0.0.0.255
#
user-interface con 0
user-interface vty 0 4
#
return
8.R1的配置
给两个连接设备的端口给地址,并通过OSPF将自身的地址宣告出去即可,配置结束。
[V200R003C00]
#
sysname R1
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 192.168.5.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.6.1 255.255.255.0
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ospf 1
area 0.0.0.0
network 192.168.5.0 0.0.0.255
network 192.168.6.0 0.0.0.255
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
9.R2的配置
给与设备连接的接口给地址,需要注意的是与cloud相连的接口地址需要根据自身的网卡来定。写一条ACL允许所有流量通过,写一条nat的地址池,在和cloudn相连的接口上使用nat outband nat outbound 2000 address-group 1 no-pat
命令,使得允许所有的内网地址转化为192.168.16.50到192.168.26.70的地址,可以ping通8.8.8.8.
通过OSPF将自身的地址宣告出去,并且写一条缺省路由ip route-static 0.0.0.0 0.0.0.0 网关
,在OSPF中利用default-route-advertise always
将路由引入,重发布,使得所有设备的路由表都可以学习到。
[V200R003C00]
#
sysname R2
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load flash:/portalpage.zip
#
drop illegal-mac alarm
#
wlan ac-global carrier id other ac id 0
#
set cpu-usage threshold 80 restore 75
#
acl number 2000
rule 5 permit
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
nat address-group 1 192.168.16.50 192.168.16.70
#
interface GigabitEthernet0/0/0
ip address 192.168.5.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.4.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 192.168.16.234 255.255.255.0
nat outbound 2000 address-group 1 no-pat
#
interface NULL0
#
ospf 1
default-route-advertise always
import-route static cost 150 type 2
area 0.0.0.0
network 192.168.4.0 0.0.0.255
network 192.168.5.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 192.168.16.2
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
以上的配置与文字描述皆是按照我的拓扑图所搭建,文字描述是本人做完之后,理得思路,有些许的混乱,一切以真实为主,以上仅供参考。