命令行清除配置再配置锐捷RSR2014E的NAT上网全过程
锐捷设备清除配置的命令主要包括以下几种:
交换机配置清除命令:
进入特权模式:输入命令 enable。
查看设备flash当前文件列表:输入命令 dir。
删除配置文件:输入命令 delete config.text。
重启设备:输入命令 reload,按回车键即可清除配置命令。
路由器配置清除命令:
清除启动配置文件:输入命令 erase startup-config。
执行此命令前,建议备份重要数据,以防数据丢失。
执行该命令后,设备会重新加载初始配置文件,恢复到出厂设置状态。
本实验测试可以在路由器外加一台电脑A或路由器B,对A或B配置一个IP即可,其它都不需要配置包括网关,用以模拟互联网
我的手敲配置过程:
(一)配置出接口(WAN)地址
Ruijie#conf t
RuiJie2014E(config)#interface gi0/1
RuiJie2014E(config-if-GigabitEthernet 0/1)#ip add 172.16.11.11 255.255.255.0
RuiJie2014E(config-if-GigabitEthernet 0/1)#ip nat outside 声明为WAN接口
RuiJie2014E(config-if-GigabitEthernet 0/1)#exit
(三)创建并进入vlan100,配置内网接口IP,可此虚vlan接口也可以是三层路由接口,本设备只能是g0/0或g0/1(LAN)
RuiJie2014E(config)#vlan 100
RuiJie2014E(config-vlan)#interface vlan 100
RuiJie2014E(config-if-VLAN 100)ip address 192.168.100.254 255.255.255.0
RuiJie2014E(config-if-VLAN 100)#ip nat inside 声明为LAN接口
RuiJie2014E(config-if-VLAN 100)#exit
(四)配置默认(缺省)路由(ISP网关)
RuiJie2014E(config)#ip route 0.0.0.0 0.0.0.0 172.16.11.254
(五)配置ACL匹配内网需要NAT的IP段
RuiJie2014E(config)#ip access-list standard 1
RuiJie2014E(config-std-nacl)#permit 192.168.100.0 0.0.0.255
RuiJie2014E(config-std-nacl)#exit
(六)ACL(内网需要NAT的IP段) 关联 出接口(WAN口)
RuiJie2014E(config)#ip nat inside source list 1 interface gigabitEthernet 0/1
RuiJie2014E(config)#exit
RuiJie2014E#write 保存配置
Building configuration...
Write to boot config file: [/config.text]
[OK]
(六)配置DHCP地址池
RuiJie2014E#conf t
RuiJie2014E(config)#service dhcp 启用dhcp服务(器)
RuiJie2014E(config)#ip dhcp pool vlan100
RuiJie2014E(dhcp-config)#network 192.168.100.0 255.255.255.0 DHCP的地址段
RuiJie2014E(dhcp-config)#dns-server 202.99.166.4 222.222.222.222
RuiJie2014E(dhcp-config)#default-router 192.168.100.254
RuiJie2014E(dhcp-config)#exit
RuiJie2014E#conf t
RuiJie2014E(config)#ip dhcp excluded-address 192.168.100.1 192.168.100.100 排除不分(DHCP)的地址段
RuiJie2014E(config)#exit
(七)交换端口加入到vlan100:单个加或范围加,(默认交换端口属于vlan1)
RuiJie2014E#conf t
RuiJie2014E(config)#interface fastEthernet 1/0
RuiJie2014E(config-if-FastEthernet 1/0)#switchport mode access
RuiJie2014E(config-if-FastEthernet 1/0)#switchport access vlan 100
RuiJie2014E(config-if-FastEthernet 1/0)#exit
RuiJie2014E(config)#interface range fastEthernet 1/1 - 23
RuiJie2014E(config-if-range)#switchport mode access
RuiJie2014E(config-if-range)#switchport access vlan 100
RuiJie2014E(config-if-range)#
---------------------------------------------------------------------------------------------以上为操作过程,以下为配置文件
RuiJie2014E>en
RuiJie2014E#show run
Building configuration...
Current configuration : 2939 bytes
!
version RGOS 10.4(3b34)p5 Release(224254)(Mon Nov 19 20:16:03 CST 2018 -ngcf65)
hostname RuiJie2014E
webmaster level 0 username admin password 7 051902330a21(admin)------默认
!
!
!
!
!
!
diffserv domain default
!
!
!
!
no cwmp
!
!
!
!
!
!
!
!
vlan 1------默认
!
vlan 100------创建vlan100
!
!
no service password-encryption
service dhcp------启用dhcp服务
!
ip dhcp excluded-address 192.168.100.1 192.168.100.100------dhcp地址池中不分的IP
!
!
ip dhcp pool vlan100------dhcp地址池
network 192.168.100.0 255.255.255.0
dns-server 202.99.166.4 222.222.222.222
default-router 192.168.100.254
!
!
!
!
!
!
!
!
!
!
!
!
!
!
ip access-list standard 1------标准ACL,匹配内网需要NAT的IP,用到反掩码
10 permit 192.168.100.0 0.0.0.255
!
!
!
!
!
control-plane
!
control-plane protocol
no acpp
!
control-plane manage
no port-filter
no arp-car
no acpp
!
control-plane data
no glean-car
no acpp
!
!
!
!
enable service web-server http------默认
enable service web-server https------默认
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet 1/0------端口加到vlan100
switchport access vlan 100
!
interface FastEthernet 1/1
switchport access vlan 100
!
interface FastEthernet 1/2
switchport access vlan 100
!
interface FastEthernet 1/3
switchport access vlan 100
!
interface FastEthernet 1/4
switchport access vlan 100
!
interface FastEthernet 1/5
switchport access vlan 100
!
interface FastEthernet 1/6
switchport access vlan 100
!
interface FastEthernet 1/7
switchport access vlan 100
!
interface FastEthernet 1/8
switchport access vlan 100
!
interface FastEthernet 1/9
switchport access vlan 100
!
interface FastEthernet 1/10
switchport access vlan 100
!
interface FastEthernet 1/11
switchport access vlan 100
!
interface FastEthernet 1/12
switchport access vlan 100
!
interface FastEthernet 1/13
switchport access vlan 100
!
interface FastEthernet 1/14
switchport access vlan 100
!
interface FastEthernet 1/15
switchport access vlan 100
!
interface FastEthernet 1/16
switchport access vlan 100
!
interface FastEthernet 1/17
switchport access vlan 100
!
interface FastEthernet 1/18
switchport access vlan 100
!
interface FastEthernet 1/19
switchport access vlan 100
!
interface FastEthernet 1/20
switchport access vlan 100
!
interface FastEthernet 1/21
switchport access vlan 100
!
interface FastEthernet 1/22
switchport access vlan 100
!
interface FastEthernet 1/23
switchport access vlan 100
!
interface GigabitEthernet 0/0------默认,恢复出厂用这个接口进行web(不需要配置)或telnet需要配置
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface GigabitEthernet 0/1------三层出接口(WAN)
ip nat outside
ip address 172.16.11.11 255.255.255.0
duplex auto
speed auto
!
interface VLAN 100------三层逻辑LAN接口
ip nat inside
ip address 192.168.100.254 255.255.255.0
!
ip nat inside source list 1 interface GigabitEthernet 0/1---关联ACL(内网IP段)和出接口或公网(ISP提供)IP一个或多个
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
ip route 0.0.0.0 0.0.0.0 172.16.11.254------缺省(默认)路由或称网关
!
!
!
!
!
ref parameter 75 140
line con 0
line aux 0
line vty 0 4
login
!
!
end
RuiJie2014E#exit
RuiJie2014E CON0 is now available
Press RETURN to get started