1.0
1.路由配置IP地址
路由为AR2220
AR2
<Huawei>SY
Enter system view, return user view with Ctrl+Z.
[Huawei]INT
[Huawei]interface ip
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]1ip ad
[Huawei-GigabitEthernet0/0/0]ip
[Huawei-GigabitEthernet0/0/0]ip ad
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.0
[Huawei-GigabitEthernet0/0/0]
Sep 18 2024 16:13:25-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
AR2
<Huawei>
Sep 18 2024 16:05:27-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEt
hernet0/0/0 has turned into UP state.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]in
[Huawei]infa
[Huawei]infac
[Huawei]inface ip
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/0]
Sep 18 2024 16:10:01-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
然后ping一下看一下是否能ping通
2.DHCP配置
在没有配置dhcp时不会自动分配地址的
接下来开始开启dhcp
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]dhc
[Huawei]dhcp en
[Huawei]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]int
[Huawei]int g0/0/0 #路由接口配置的是0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp
[Huawei-GigabitEthernet0/0/0]dhcp sel
[Huawei-GigabitEthernet0/0/0]dhcp select in
[Huawei-GigabitEthernet0/0/0]dhcp select interface
[Huawei-GigabitEthernet0/0/0]
接下来在pc端选择dhcp,然后查看ip
3.DNS域名系统
用dns实现域名解析
(网关暂不设置后面再来)
2.在路由里面配置dns
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp ser
[Huawei-GigabitEthernet0/0/0]dhcp server dn
[Huawei-GigabitEthernet0/0/0]dhcp server dns-list 192.168.1.100 # server服务器配置的ip地址为192.168.1.100
[Huawei-GigabitEthernet0/0/0]
然后就可以直接用域名方式来ping
4.路由技术基础
通过网关去链接100.100.100.100
[Huawei]int g0/0/1 #因为100这个连接的是ge0/0/1这个接口所以在这个接口配置
[Huawei-GigabitEthernet0/0/1]ip add 100.100.100.1 255.255.255.0
[Huawei-GigabitEthernet0/0/1]
Sep 18 2024 16:51:39-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
现在配置完了可以通过192.pc端去ping100
路由器连接多个端口是怎么判断的
路由器有个判断机制是通过路由表来的
Huawei]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.100.100.0/24 Direct 0 0 D 100.100.100.1 GigabitEthernet
0/0/1
100.100.100.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
100.100.100.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
可以通过指定ip来查看想要的那个
[Huawei]display ip routing-table 100.100.100.100
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
100.100.100.0/24 Direct 0 0 D 100.100.100.1 GigabitEthernet
0/0/1
5.0小总结
1.电脑开机,通过dhcp获取ip地址
2.电脑输入域名,www.baidu.com 电脑吧 域名发到dns服务器进行解析
3.dns服务器把请求的域名解析成对应ip地址
4.电脑向服务器发送一个请求
2.0
1.静态路由
PC:
路由R1(配置接口0和1):
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.10 255.255.255.0
[Huawei-GigabitEthernet0/0/0]
Sep 18 2024 17:15:22-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]sys
[Huawei]sysname R1
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.2.1 255.255.255.0
[R1-GigabitEthernet0/0/1]
Sep 18 2024 17:17:57-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
路由R2:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.10 255.255.255.0
[R2-GigabitEthernet0/0/0]
Sep 18 2024 17:20:59-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.3.1 255.255.255.0
[R2-GigabitEthernet0/0/1]
Sep 18 2024 17:21:42-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]q #退出
<R2> save #保存
server:
现在互相ping不同的
通过数据包传递1<=>2<=>3
开始添加静态路由
先配置R1
<R1>sy
Enter system view, return user view with Ctrl+Z.
[R1]ip rout
[R1]ip route-s
[R1]ip route-static 192.168.3.0 255.255.255.0 192.168.2.10
[R1]dis ip rou
[R1]dis ip routing-table 192.168.3.10
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.3.0/24 Static 60 0 RD 192.168.2.10 GigabitEthernet
0/0/1
同理配置R2
[R2]ip route-static 192.168.1.1 255.255.255.0 192.168.2.1
[R2]display ip routing-table 192.168.1.1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.1.0/24 Static 60 0 RD 192.168.2.1 GigabitEthernet
0/0/0
现在就可以互相通信了