有公网IP就可以。
互联网 ←→ 光猫 ←→ MSR830 ←→ 内部网络# 在路由器上执行
display ip interface brief# 进入系统视图
system-view
# 启用HTTP服务(默认端口80)
ip http enable
# 启用HTTPS服务(推荐,默认端口443,更安全)
ip https enable
# 创建SSL策略(如需)
ssl server-policy default_policy
rsa local-key-pair create
# 为HTTPS创建本地证书
pki domain default
public-key rsa general name default_key
quit# 创建本地用户
local-user admin
password simple 你的密码
service-type http https ssh terminal
authorization-attribute user-role network-admin
quit
# 设置Web服务参数
ip http acl 2000 # 可选,用于限制访问源# 创建ACL允许远程访问
acl number 3000
rule 5 permit tcp destination-port eq www
rule 10 permit tcp destination-port eq 443
rule 15 permit tcp destination-port eq 22
quit
# 在接口上应用(假设WAN口是GigabitEthernet0/0)
interface GigabitEthernet0/0
firewall packet-filter 3000 inbound
quit# 生成RSA密钥对
rsa local-key-pair create
# 启用SSH服务
stelnet server enable
ssh server enable
# 设置SSH用户认证
user-interface vty 0 4
authentication-mode scheme
protocol inbound ssh
user-role network-admin
quit
# 设置SSH版本(推荐使用SSH2)
ssh server compatible-ssh1x disable
ssh server authentication-retries 3
ssh server timeout 60# 将SSH端口改为非默认的2222
ssh server port 2222# 1. 配置IPSec提议
ipsec proposal 1
esp encryption-algorithm aes-cbc-256
esp authentication-algorithm sha1
quit
# 2. 配置IKE对等体
ike peer peer1
pre-shared-key simple 你的预共享密钥
quit
# 3. 配置IPSec策略
ipsec policy policy1 1 isakmp
security acl 3001
ike-peer peer1
proposal 1
quit
# 4. 配置L2TP
l2tp enable
l2tp-group 1
allow l2tp virtual-template 1 remote 路由器名称
tunnel authentication
tunnel password simple 隧道密码
quit
# 5. 创建虚拟模板
interface virtual-template 1
ppp authentication-mode pap
ppp ipcp dns 8.8.8.8
ip address 192.168.100.1 255.255.255.0
remote address pool 1
quit
# 6. 创建地址池
ip pool 1
network 192.168.100.0 mask 255.255.255.0
gateway-list 192.168.100.1
quit外部端口: 8443 → 内部IP: MSR830的LAN IP → 内部端口: 443
外部端口: 2222 → 内部IP: MSR830的LAN IP → 内部端口: 22# 确保MSR830有固定LAN IP
interface GigabitEthernet0/1
ip address 192.168.1.1 255.255.255.0
nat server protocol tcp global 光猫公网IP 8443 inside 192.168.1.1 443
nat server protocol tcp global 光猫公网IP 2222 inside 192.168.1.1 22
quitsystem-view
sysname MSR830-Router
# 1. 基础网络配置
interface GigabitEthernet0/0
description WAN-Interface
ip address dhcp-alloc
nat outbound
quit
interface GigabitEthernet0/1
description LAN-Interface
ip address 192.168.1.1 255.255.255.0
quit
# 2. 创建管理用户
local-user admin
password irreversible-cipher 你的强密码
service-type http https ssh terminal
authorization-attribute user-role network-admin
level 3
quit
local-user viewonly
password irreversible-cipher 只读密码
service-type http https ssh terminal
authorization-attribute user-role network-operator
quit
# 3. 启用管理服务
ip http enable
ip https enable
stelnet server enable
ssh server enable
ssh server port 2222
telnet server enable # 不推荐,仅备用
# 4. 配置ACL限制访问
acl advanced 3000
rule 5 permit tcp destination-port eq 2222
rule 10 permit tcp destination-port eq www
rule 15 permit tcp destination-port eq 443
rule 20 permit tcp destination-port eq telnet
rule 100 deny ip
quit
# 5. 应用ACL到WAN口
interface GigabitEthernet0/0
firewall packet-filter 3000 inbound
quit
# 6. 配置VTY线路
user-interface vty 0 4
authentication-mode scheme
protocol inbound all
user-role network-admin
idle-timeout 10
quit
# 7. 保存配置
save force地址:https://公网IP地址:443
或: https://公网IP地址:8443(如果修改了端口)# Windows使用PuTTY,Mac/Linux使用终端
ssh admin@公网IP地址 -p 2222# 修改默认密码
local-user admin
password irreversible-cipher 新强密码
quit
# 禁用不必要服务
undo ip http enable # 如果只用HTTPS
undo telnet server enable # 禁用Telnet
# 限制访问源IP
acl number 2000
rule 5 permit source 你的固定公网IP 0
rule 10 deny
quit
ip https acl 2000
ssh server acl 2000info-center enable
info-center loghost 192.168.1.100# 查看当前登录用户
display users
# 查看登录日志
display logbuffer
# 查看攻击防御
display firewall-statisticsdisplay ip http/ display ssh server status)# 检查接口状态
display interface brief
# 检查NAT会话
display nat session
# 测试连通性
ping 公网测试IP
# 查看当前配置
display current-configurationdisplay version)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论