有没有路由器和交换机组合的上网配置案例? 最好是从简单到复杂的 。谢谢
(0)
最佳答案
参考:
#配置虚接口地址
<H3C>system-view
[H3C]interface Vlan-interface 1
[H3C-Vlan-interface1]ip address 192.168.1.1 24
[H3C-Vlan-interface1]quit
#添加两条静态路由
[H3C]ip route-static 192.168.2.0 24 192.168.1.254
[H3C]ip route-static 192.168.3.0 24 192.168.1.254
#保存配置
[H3C]save force
#创建vlan
<H3C>system-view
[H3C]vlan 2 to 3
#创建虚接口地址,vlan2和vlan3的地址分别作为PC1和PC2的网关
[H3C]interface vlan 1
[H3C-Vlan-interface1]ip address 192.168.1.254 24
[H3C]interface vlan 2
[H3C-Vlan-interface2]ip address 192.168.2.1 24
[H3C]interface vlan 3
[H3C-Vlan-interface3]ip address 192.168.3.1 24
#将连接PC1和PC2接口划分到相应的vlan中
[H3C]interface GigabitEthernet 1/0/2
[H3C-GigabitEthernet1/0/2] port access vlan 2
[H3C-GigabitEthernet1/0/2]interface GigabitEthernet 1/0/3
[H3C-GigabitEthernet1/0/3] port access vlan 3
#添加静态路由,指向路由器的网关
[H3C]ip route-static 0.0.0.0 0 192.168.1.1
#保存配置
[H3C]save force
(0)
1.2配置需求及实现的效果
MSR路由器作为下面两个网段,192.168.1.0/24网段和192.168.2.0/24网段的网关。将路由器的G0/0口与交换机G1/0/1口相连,在路由器G0/0上创建虚地址;交换机与路由器的互连接口都配置成trunk口,并放通vlan2通过。交换机的G1/0/2接PC1,G1/0/3接PC2,要求PC1和PC2可以访问互联网(访问路由器的网关)。
3.1路由器端配置
#创建vlan
<H3C> system-view
[H3C] interface vlan 2
#配置虚接口地址,作为PC的网关
[H3C]interface Vlan-interface 1
[H3C-Vlan-interface1] ip address 192.168.1.1 24
[H3C-Vlan-interface1] interface Vlan-interface 2
[H3C-Vlan-interface2]ip address 192.168.2.1 24
[H3C-Vlan-interface2]quit
#将与交换机互连的接口配置成trunk口,并放通所有vlan
[H3C]interface GigabitEthernet 0/2
[H3C-GigabitEthernet0/2]port link-type trunk
[H3C-GigabitEthernet0/2]port trunk permit vlan all
#保存配置
[H3C]save force
3.2交换机端的配置
#创建vlan
<H3C>system-view
[H3C]interface vlan 2
#将连接路由器的接口切换成trunk口,并放通所有vlan
[H3C]interface GigabitEthernet 1/0/1
[H3C-GigabitEthernet1/0/1]port link-type trunk
[H3C-GigabitEthernet1/0/1]port trunk permit vlan all
[H3C-GigabitEthernet1/0/1]quit
#将连接PC1和PC2接口划分到相应的vlan中
[H3C]interface GigabitEthernet 1/0/2
[H3C-GigabitEthernet1/0/2] port access vlan 1
[H3C-GigabitEthernet1/0/2] interface GigabitEthernet 1/0/3
[H3C-GigabitEthernet1/0/2] port access vlan 2
#保存配置
[H3C]save force
(0)
暂无评论
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论