有时候不方便用WEB页面配置路由器,今天就结合WEB页面和命令行模式如何的配置WAN口静态IP,实现上网功能,详情页面参考H3C官网:https://www.h3c.com/cn/d_202212/1749578_30005_40.htm
路由器概述
[H3C]display version
H3C Comware Software, Version 7.1.064, Release 6728P25
Copyright (c) 2004-2022 New H3C Technologies Co., Ltd. All rights reserved.
H3C MER8300 uptime is 0 weeks, 0 days, 0 hours, 12 minutes
Last reboot reason : Power on
Boot image: flash:/mer8300-cmw710-boot-r6728p25.bin
Boot image version: 7.1.064P80, Release 6728P25
Compiled Nov 23 2022 15:00:00
System image: flash:/mer8300-cmw710-system-r6728p25.bin
System image version: 7.1.064, Release 6728P25
Compiled Nov 23 2022 15:00:00
Feature image(s) list:
flash:/mer8300-cmw710-security-r6728p25.bin, version: 7.1.064
Compiled Nov 23 2022 15:00:00
flash:/mer8300-cmw710-voice-r6728p25.bin, version: 7.1.064
Compiled Nov 23 2022 15:00:00
flash:/mer8300-cmw710-data-r6728p25.bin, version: 7.1.064
Compiled Nov 23 2022 15:00:00
CPU ID: 0x11
2G bytes DDR3 SDRAM Memory
8M bytes Flash Memory
PCB Version: 2.0
CPLD Version: 1.0
Basic BootWare Version: 1.32
Extended BootWare Version: 1.32
[SLOT 0]CON (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]GE0/0 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]GE0/1 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]GE0/2 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]GE0/3 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]SFP0/4 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]SFP0/5 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 0]CELLULAR0/0 (Hardware)2.0, (Driver)1.0, (CPLD)1.0
[SLOT 2]SIC-4GSW (Hardware)2.0, (Driver)1.0, (CPLD)1.0
Console口配置
在通过Console口搭建本地配置环境时,需要通过超级终端或PuTTY,SecureCRT等终端仿真程序与设备建立连接。用户可以运行这些程序来连接网络设备、Telnet或SSH站点,这些程序的详细介绍和使用方法请参见该程序的使用指导。打开终端仿真程序后,请按如下要求设置终端参数
· 波特率:9600
· 数据位:8
· 停止位:1
· 奇偶校验:无
· 流量控制:无
设备上电,终端上显示设备自检信息,自检结束后提示用户键入回车,出现命令行提示符即可键入命令来配置设备或查看设备运行状态,需要帮助可以随时键入“?”。
- Console口安全配置
system
line aux 0
authentication-mode password
set authentication password simple Zxb@=1234qwer
user-role network-admin
quit
save
路由器命令行下开局配置
- 开启Telnet 服务
telnet server enable
- 修改默认用户名密码
[H3C]local-user admin
password simple Mj@=1234qwer.
authorization-attribute user-role network-admin #web页面会提示输入旧密码设置新密码,老旧都输入Mj@=1234qwer.就OK了
- 管理接口地址配置
#
interface Vlan-interface1
description LAN-interface
ip address 192.168.1.1 255.255.254.0
tcp mss 1280
#
- 命令行下DHCP配置
#
dhcp server ip-pool lan1
gateway-list 192.168.1.1
network 192.168.0.0 mask 255.255.254.0
address range 192.168.1.2 192.168.1.254
dns-list 192.168.1.1
#
- 查看WAN口g0/0口获取地址情况:
- 查看静态路由表
- 全局下开启dns proxy enable
#
dns proxy enable
dns server 10.66.77.1
dns server 10.69.218.192
dns server 114.114.114.114
dns server 202.102.192.68
dns server 202.102.199.68
#
WAN口G0/0下静态IP配置
#
interface GigabitEthernet0/0
port link-mode route
description Single_Line1 #此条命令会配置显示到web页面上,如下图所示
ip address 192.168.3.66 255.255.255.0
dns server 202.102.192.68
dns server 202.102.199.68
tcp mss 1280
nat outbound
#
#
interface GigabitEthernet0/0
port link-mode route
description Multiple_Line1
ip address 61.191.98.15 255.255.255.0
dns server 202.102.192.68
dns server 202.102.199.68
tcp mss 1280
ip last-hop hold
packet-filter name GigabitEthernet0/0 inbound
nat outbound
nat server protocol tcp global current-interface 1444 inside 192.168.100.100 443 description Esxi8.0
nat server protocol tcp global current-interface 9002 inside 192.168.100.102 9001 description speedtest-x
attack-defense apply policy AtkInterface2
#
- dhcp上网时外网口配置如下
<H3C>system-view
[H3C]interface GigabitEthernet 0/0
[H3C-GigabitEthernet0/0] ip address dhcp-alloc //配置外网口地址为自动获取,当自动获取到地址后会自动生成优先级为70的默认路由
[H3C-GigabitEthernet0/0] nat outbound //开启nat转换
- pppoe拨号上网时外网口配置如下
#配置拨号口,拨号的用户名为abc,密码为123456
<H3C>system-view
[H3C] dialer-group 1 rule ip permit //设置拨号访问组1,对IP协议报文进行DDR拨号
[H3C] interface dialer 1 //创建拨号口1
[H3C-Dialer1] dialer bundle enable //在接口Dialer1上使能共享DDR
[H3C-Dialer1] dialer-group 1 //创建拨号组1
[H3C-Dialer1] ip address ppp-negotiate //ip地址为自动协商
[H3C-Dialer1] dialer timer idle 0 //允许链路空闲时间位0,即永久在线
[H3C-Dialer1] ppp chap user abc //配置拨号的用户名
[H3C-Dialer1] ppp chap password simple 123456 //配置拨号的密码
[H3C-Dialer1] ppp pap local-user abc password simple 123456 //将用户密码和密码一起输入
[H3C-Dialer1] ppp ipcp dns admit-any //设备不发送DNS请求,也能接收对端设备分配的DNS服务器的IP地址。
[H3C-Dialer1] ppp ipcp dns request //配置设备可以主动向对端请求DNS服务器地址
[H3C-Dialer1] nat outbound //开启nat转换
[H3C-Dialer1] quit
#将拨号口绑定实际的物理接口
[H3C]interface GigabitEthernet 0/0
[H3C-GigabitEthernet0/0] pppoe-client dial-bundle-number 1
H3C V7交换机软件版本升级方法:https://www.hao0564.com/3601.html
(1)恢复出厂
#清除已保存的配置
reset save //清除已保存的配置,选择Y
#重启设备
reboot //重启设备 一定要先选N,再选Y。
(2)修改登录密码
system-view //进入系统视图
System View: return to User View with Ctrl+Z.
# 配置WEB用户admin的认证密码为admin
[H3C]local-user admin //创建本地账号admin
[H3C-luser-manage-admin] password simple admin //密码为admin
[H3C-luser-manage-admin] quit //退出当前视图
#保存配置
[H3C]save force //保存配置
1,[MER8300]display arp 192.168.20.177
Type: S-Static D-Dynamic O-Openflow R-Rule I-Invalid
IP address MAC address VLAN/VSI name Interface/Link ID Aging Type
192.168.20.177 5405-db00-f0d4 20 GE2/0 20 D
2,[MER8300]display lldp neighbor-information list
Chassis ID : * — — Nearest nontpmr bridge neighbor
# — — Nearest customer bridge neighbor
Default — — Nearest bridge neighbor
Local Interface Chassis ID Port ID System Name
GE0/3 00e2-6962-e4f3 eth0 iKuai-X86
GE2/0 a8c9-8ae6-4c21 GigabitEthernet1/0/23 门诊大楼1楼
GE2/1 鍒涗笘绾綉缁滃伐绋?d85e-d324-a100 –
3,[门诊大楼1楼-GigabitEthernet1/0/3]display mac-address 5405-db00-f0d4
MAC Address VLAN ID State Port/Nickname Aging
5405-db00-f0d4 20 Learned GE1/0/3 Y
#
interface GigabitEthernet0/0
port link-mode route
description Multiple_Line1
ip address 61.191.98.15 255.255.255.0
dns server 202.102.192.68
dns server 202.102.199.68
tcp mss 1280
ip last-hop hold
packet-filter name GigabitEthernet0/0 inbound
nat outbound
nat server protocol tcp global current-interface 1443 inside 192.168.100.100 443 description Esxi8.0
nat server protocol tcp global current-interface 9001 inside 192.168.100.102 9001 description speedtest-x
attack-defense apply policy AtkInterface2
#