路由器交换与配置综合实验(一)内网配置

实验拓扑图

 分析:内网不能直接接入外网,可通过NAT转换接入外网,模拟现实生活中的网络

步骤:先配置内网,再配置外网,实现连接

1.配置主机

 

 2.在二层交换机上划分vlan

[H3C]sysn SW1
[SW1]vlan 10
[SW1-vlan10]port g1/0/1
[SW1-vlan10]vlan 20
[SW1-vlan20]port g1/0/2
[SW1-vlan20]quit

可通过display vlan 查看vlan是否划分成功

[SW1]dis vlan 10
 VLAN ID: 10
 VLAN type: Static
 Route interface: Not configured
 Description: VLAN 0010
 Name: VLAN 0010
 Tagged ports:   None
 Untagged ports:
    GigabitEthernet1/0/1

[SW1]dis vlan 20
 VLAN ID: 20
 VLAN type: Static
 Route interface: Not configured
 Description: VLAN 0020
 Name: VLAN 0020
 Tagged ports:   None
 Untagged ports:
    GigabitEthernet1/0/2

SW1和SW2连接使用链路聚合,据分析,网关应该配置在SW2上

[SW1]inter Bridge-Aggregation 1
[SW1-Bridge-Aggregation1]quit
[SW1]inter g1/0/3
[SW1-GigabitEthernet1/0/3]port link-aggregation group 1

[SW1-GigabitEthernet1/0/3]inter g1/0/4
[SW1-GigabitEthernet1/0/4]port link-aggregation group 1
[SW1-GigabitEthernet1/0/4]quit

[SW1]inter Bridge-Aggregation 1

[SW1-Bridge-Aggregation1]port link-type trunk
Configuring GigabitEthernet1/0/3 done.
Configuring GigabitEthernet1/0/4 done.

[SW1-Bridge-Aggregation1]port trunk permit vlan 10 20
Configuring GigabitEthernet1/0/3 done.
Configuring GigabitEthernet1/0/4 done.
[SW1-Bridge-Aggregation1]quit

通过display 查看聚合状态 出现下图说明可继续进行下一步、

[SW1]dis link-aggregation summary
Aggregation Interface Type:
BAGG -- Bridge-Aggregation, BLAGG -- Blade-Aggregation, RAGG -- Route-Aggregation, SCH-B -- Schannel-Bundle
Aggregation Mode: S -- Static, D -- Dynamic
Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing
Actor System ID: 0x8000, 7a1b-0c9f-0300

AGG        AGG   Partner ID              Selected  Unselected  Individual  Share
Interface  Mode                          Ports     Ports       Ports       Type
--------------------------------------------------------------------------------
BAGG1      S     None                    2         0           0           Shar

配置SW2

[SW2]inter Bridge-Aggregation 1
[SW2-Bridge-Aggregation1]quit

[SW2]inter g1/0/3
[SW2-GigabitEthernet1/0/3]port link-aggregation group 1

[SW2-GigabitEthernet1/0/3]inter g1/0/4
[SW2-GigabitEthernet1/0/4]port link-aggregation group 1
[SW2-GigabitEthernet1/0/4]quit
[SW2]inter br
[SW2]inter Bridge-Aggregation 1

[SW2-Bridge-Aggregation1]port link-type trunk
Configuring GigabitEthernet1/0/3 done.
Configuring GigabitEthernet1/0/4 done.

[SW2-Bridge-Aggregation1]port trunk permit vlan 10 20
Configuring GigabitEthernet1/0/3 done.
Configuring GigabitEthernet1/0/4 done.

[SW2-Bridge-Aggregation1]quit

[SW2]dis link-aggregation  summary
Aggregation Interface Type:
BAGG -- Bridge-Aggregation, BLAGG -- Blade-Aggregation, RAGG -- Route-Aggregation, SCH-B -- Schannel-Bundle
Aggregation Mode: S -- Static, D -- Dynamic
Loadsharing Type: Shar -- Loadsharing, NonS -- Non-Loadsharing
Actor System ID: 0x8000, 7a1b-172c-0400

AGG        AGG   Partner ID              Selected  Unselected  Individual  Share
Interface  Mode                          Ports     Ports       Ports       Type
--------------------------------------------------------------------------------
BAGG1      S     None                    2         0           0           Shar

3.配置vlan 的网关

[SW2]vlan 10
[SW2-vlan10]vlan 20
[SW2-vlan20]quit
[SW2]dis vlan 10
 VLAN ID: 10
 VLAN type: Static
 Route interface: Not configured
 Description: VLAN 0010
 Name: VLAN 0010
 Tagged ports:
    Bridge-Aggregation1
    GigabitEthernet1/0/3          GigabitEthernet1/0/4
 Untagged ports: None


[SW2]dis vlan 20
 VLAN ID: 20
 VLAN type: Static
 Route interface: Not configured
 Description: VLAN 0020
 Name: VLAN 0020
 Tagged ports:
    Bridge-Aggregation1
    GigabitEthernet1/0/3          GigabitEthernet1/0/4
 Untagged ports: None

添加ip 配置网关

[SW2]inter vlan 10

[SW2-Vlan-interface10]ip add 172.16.1.254 24

[SW2-Vlan-interface10]inter vlan 20
[SW2-Vlan-interface20]ip add 172.16.2.254 24
[SW2-Vlan-interface20]quit

查看路由表,出现172.161.1 和172.161.2字段说明添加成功

[SW2-Vlan-interface20]dis ip routing-table

Destinations : 16       Routes : 16

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
172.16.1.0/24      Direct  0   0           172.16.1.254    Vlan10
172.16.1.0/32      Direct  0   0           172.16.1.254    Vlan10
172.16.1.254/32    Direct  0   0           127.0.0.1       InLoop0
172.16.1.255/32    Direct  0   0           172.16.1.254    Vlan10
172.16.2.0/24      Direct  0   0           172.16.2.254    Vlan20
172.16.2.0/32      Direct  0   0           172.16.2.254    Vlan20
172.16.2.254/32    Direct  0   0           127.0.0.1       InLoop0
172.16.2.255/32    Direct  0   0           172.16.2.254    Vlan20
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

测试网关与主机之间的连通性

[SW2-Vlan-interface20]ping 172.16.1.1
Ping 172.16.1.1 (172.16.1.1): 56 data bytes, press CTRL_C to break
56 bytes from 172.16.1.1: icmp_seq=0 ttl=255 time=2.000 ms
56 bytes from 172.16.1.1: icmp_seq=1 ttl=255 time=3.000 ms
56 bytes from 172.16.1.1: icmp_seq=2 ttl=255 time=2.000 ms
56 bytes from 172.16.1.1: icmp_seq=3 ttl=255 time=2.000 ms
56 bytes from 172.16.1.1: icmp_seq=4 ttl=255 time=2.000 ms

--- Ping statistics for 172.16.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.000/2.200/3.000/0.400 ms
[SW2-Vlan-interface20]%Dec 21 10:56:29:155 2021 SW2 PING/6/PING_STATISTICS: Ping statistics for 172.16.1.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 2.000/2.200/3.000/0.400 ms.

[SW2-Vlan-interface20]ping 172.16.2.1
Ping 172.16.2.1 (172.16.2.1): 56 data bytes, press CTRL_C to break
56 bytes from 172.16.2.1: icmp_seq=0 ttl=255 time=1.000 ms
56 bytes from 172.16.2.1: icmp_seq=1 ttl=255 time=3.000 ms
56 bytes from 172.16.2.1: icmp_seq=2 ttl=255 time=3.000 ms
56 bytes from 172.16.2.1: icmp_seq=3 ttl=255 time=2.000 ms
56 bytes from 172.16.2.1: icmp_seq=4 ttl=255 time=3.000 ms

--- Ping statistics for 172.16.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/2.400/3.000/0.800 ms
[SW2-Vlan-interface20]%Dec 21 10:56:40:166 2021 SW2 PING/6/PING_STATISTICS: Ping statistics for 172.16.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/2.400/3.000/0.800 ms.

测试pc1和pc2之间的连通性

在pc2中输入

<H3C>ping 172.16.1.1

在pc1中输入

<h3c>ping 1172.16.2.1

SW2与RT1之间通过g1/0/5连接,在SW2中配置接口的IP地址

[SW2]vlan 30
[SW2-vlan30]port g1/0/5
[SW2-vlan30]inter vlan 30
[SW2-Vlan-interface30]ip add 10.0.0.1 30

查看路由表,出现10.0.0字段则说明接口连接正常

[SW2-Vlan-interface30]dis ip routing-table

Destinations : 20       Routes : 20

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/30        Direct  0   0           10.0.0.1        Vlan30
10.0.0.0/32        Direct  0   0           10.0.0.1        Vlan30
10.0.0.1/32        Direct  0   0           127.0.0.1       InLoop0
10.0.0.3/32        Direct  0   0           10.0.0.1        Vlan30
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
172.16.1.0/24      Direct  0   0           172.16.1.254    Vlan10
172.16.1.0/32      Direct  0   0           172.16.1.254    Vlan10
172.16.1.254/32    Direct  0   0           127.0.0.1       InLoop0
172.16.1.255/32    Direct  0   0           172.16.1.254    Vlan10
172.16.2.0/24      Direct  0   0           172.16.2.254    Vlan20
172.16.2.0/32      Direct  0   0           172.16.2.254    Vlan20
172.16.2.254/32    Direct  0   0           127.0.0.1       InLoop0
172.16.2.255/32    Direct  0   0           172.16.2.254    Vlan20
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0

4.进行路由器RT1配置内网

[RT1]inter g0/0
[RT1-GigabitEthernet0/0]ip add 10.0.0.2 30
[RT1-GigabitEthernet0/0]quit

查看路由表,出现10.0.0.2字段说明IP地址添加成功

[RT1]dis ip routing-table

Destinations : 12       Routes : 12

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/30        Direct  0   0           10.0.0.2        GE0/0
10.0.0.0/32        Direct  0   0           10.0.0.2        GE0/0
10.0.0.2/32        Direct  0   0           127.0.0.1       InLoop0
10.0.0.3/32        Direct  0   0           10.0.0.2        GE0/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

检查路由器RT1和交换机SW2之间的连通性


[RT1]ping 10.0.0.1

为了使内网中主机和RT1连通,内网中应配置静态路由

[RT1]ip route-static 172.16.1.0 24 10.0.0.1

[RT1]ip route-static 172.16.2.0 24 10.0.0.1

查看路由表出现172.16.1和172.16.2字段说明添加静态路由成功

[RT1]dis ip routing-table

Destinations : 14       Routes : 14

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
10.0.0.0/30        Direct  0   0           10.0.0.2        GE0/0
10.0.0.0/32        Direct  0   0           10.0.0.2        GE0/0
10.0.0.2/32        Direct  0   0           127.0.0.1       InLoop0
10.0.0.3/32        Direct  0   0           10.0.0.2        GE0/0
127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0
127.0.0.0/32       Direct  0   0           127.0.0.1       InLoop0
127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0
127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0
172.16.1.0/24      Static  60  0           10.0.0.1        GE0/0
172.16.2.0/24      Static  60  0           10.0.0.1        GE0/0
224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0
224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0
255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

检查连通性

与主机之间的连通性

[RT1]ping 172.16.1.1
Ping 172.16.1.1 (172.16.1.1): 56 data bytes, press CTRL_C to break
56 bytes from 172.16.1.1: icmp_seq=0 ttl=254 time=1.000 ms
56 bytes from 172.16.1.1: icmp_seq=1 ttl=254 time=1.000 ms
56 bytes from 172.16.1.1: icmp_seq=2 ttl=254 time=1.000 ms
56 bytes from 172.16.1.1: icmp_seq=3 ttl=254 time=2.000 ms
56 bytes from 172.16.1.1: icmp_seq=4 ttl=254 time=3.000 ms

--- Ping statistics for 172.16.1.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/1.600/3.000/0.800 ms
[RT1]%Dec 21 11:07:59:301 2021 RT1 PING/6/PING_STATISTICS: Ping statistics for 172.16.1.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/1.600/3.000/0.800 ms.



[RT1]ping 172.16.2.1
Ping 172.16.2.1 (172.16.2.1): 56 data bytes, press CTRL_C to break
56 bytes from 172.16.2.1: icmp_seq=0 ttl=254 time=2.000 ms
56 bytes from 172.16.2.1: icmp_seq=1 ttl=254 time=2.000 ms
56 bytes from 172.16.2.1: icmp_seq=2 ttl=254 time=2.000 ms
56 bytes from 172.16.2.1: icmp_seq=3 ttl=254 time=3.000 ms
56 bytes from 172.16.2.1: icmp_seq=4 ttl=254 time=4.000 ms

--- Ping statistics for 172.16.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.000/2.600/4.000/0.800 ms
[RT1]%Dec 21 11:08:04:888 2021 RT1 PING/6/PING_STATISTICS: Ping statistics for 172.16.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 2.000/2.600/4.000/0.800 ms.

内网配置完毕

  • 6
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值