华三网络配置

时间:2024-02-29 17:15:17

基本概念

  1. port link-mode bridge二层口/route三层口。二层口对应数据链路层,处理mac地址、端口之间的转发关系。三层口对应网络层,处理IP、寻址、路由的问题。防火墙的某个口可以被定义成bridge/route口
  2. vlan的作用是分割广播域,因此属于第二层数据链路层。
  3. 二层口可以设置:port link-type access只允许对应vlan通过,用于连接用户设备/trunk允许多个vlan通过,用于连接其他交换机。

# 典型的配置如下:
dis interface brief
Brief information on interfaces in route mode:
Interface Link Protocol Primary IP Description
GE1/0/0 DOWN DOWN 192.168.0.1
GE1/0/1 UP UP 183.195.. waiwangkou
GE1/0/2 DOWN DOWN 192.168.1.1
Vlan101 UP UP 10.10.101.254
Vlan102 UP UP 10.10.102.254

Brief information on interfaces in bridge mode:
Speed: (a) - auto
Duplex: (a)/A - auto; H - half; F - full
Type: A - access; T - trunk; H - hybrid
Interface Link Speed Duplex Type PVID Description
GE1/0/3 DOWN auto A A 101
GE1/0/4 DOWN auto A A 101
GE1/0/5 UP 1G(a) F(a) T 1 topoe

# 店名+ip
sysname 店名-117.254

# 防火墙连交换机的口也是trunk,并且全通
interface GigabitEthernet 1/0/6
port link-mode bridge
port link-type trunk
port trunk permit vlan all

# 把5-10号口都改成2层口,默认的3层口加入安全区时会报如下错:
# The vlan keyword is not supported for a Layer 3 interface
interface range GigabitEthernet 1/0/5 to GigabitEthernet 1/0/10
port link-mode bridge
security-zone name Trust
import interface GigabitEthernet1/0/5 vlan 117 to 118

# 要添加虚拟类型终端vty的设置,不然无法从ssh登录
ssh server enable
ssh user admin service-type stelnet authentication-type password
line vty 0 4
authentication-mode scheme
user-role network-admin
idle-timeout 30 0
line vty 5 63
authentication-mode scheme
user-role network-admin

# dhcp禁止1-200、250-254的ip段
dhcp enable
dhcp server forbidden-ip 117.1 117.200
dhcp server forbidden-ip 117.250 117.254
dhcp server forbidden-ip 118.250 118.254

# 打开dns代理,这样下面的机器dns只要设成网关即可
dns proxy enable
dns server 223.6.6.6

# 利用ntp触发vpn,当然也可以用来对时
ntp-service enable
ntp-service refclock-master
ntp-service unicast-server 117.99
ntp-service unicast-server 10.99

# 配置当前交换机的ip
interface Vlan-interface117
ip address 117.252 255.255.255.0

# 配置当前交换机的网关
ip route-static 0.0.0.0 0 117.254

# 最后1个口(比如24号口)连防火墙,所以这个口全通
interface GigabitEthernet1/0/24
port link-type trunk
port trunk permit vlan all

# 所有poe口要启用,默认没启用
interface range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/24
poe enable

参考

《OSI七层模型详解(物理层、数据链路层、网络层、传输层.....应用层协议与硬件)》:这篇文章对7层解释的很不错,比如:“一个设备工作在哪一层,关键看它工作时利用哪一层的数据头部信息。网桥工作时,是以MAC头部来决定转发端口的,因此显然它是数据链路层的设备”