容器网络

  • docker run -d –rm redis 运行结束后删除
  • –rm 容器退出时自动清理容器内部的文件系统
  • docker run -d –rm -v /tmp:/tmp redis
  • -v 挂载本机目录到容器目录中
  • docker run -d –rm –net=host nginx:alpine
  • –net 使用的网络模式
  • ip addr # 本机查看网卡
  • docker exec xxx ip addr # 容器查看网卡
  • docker inspect xxx |grep IPAddress #直接查看容器的IP
docker 提供的网络模式
null不连接任何网络
host共享主机网络
bridge 使用nat 网络默认
  • 使用桥接模式下指定端口号
  • docker run -d –rm -p 8080:80 nginx:alpine 本机的8080 映射到容器的80端口
  • docker run -d –rm -p 80:80 nginx:alpine
  • 可以使用docker ps 命令查看端口转发的情况

常用的镜像和容器操作

  • docker run busybox echo hello world
  • docker run -it ubuntu:18.04 sh
  • 镜像命名出2部分组成名字:标签
  • 删除镜像 docker rmi ubuntu:18.04
常用镜像操作命令命令解释
docker pull拉取镜像
docker images 查看镜像
docker rmi删除镜像
docker rm删除容器
常用容器操作命令命令解释
docker run -h srv alpine hostname
docker run -d redis sh 后台运行redis
docker run -it –name redis 23d sh
docker exec -it redis sh 进入运行中的容器

docker 常用命令及概念

  • 容器运行时 ( Container Runtime )
  • 容器 (Container)
  • OCI 开放容器接口(Open Container Interface)
  • 镜像 ( Image )
  • Docker 安装 apt install -y docker.io
  • Docker 容器运行 docker run
  • Docker 镜像的搜索 docker search
  • Docker 容器停止 docker stop
  • Docker 客户端,服务器,安装环境验证 docker version 、docker info
  • 查看运行中的容器 docker ps
  • 查看所有容器包括退出的容器 docker ps -a
  • docker 镜像具体可以使用帮助 docker image help 例:docker image pull –help

windows 查看tcp 连接

netstat -ano | ForEach-Object {
    $pid = $_.Split(' ')[-1]
    if ($pid -ne '') {
        $process = Get-Process -Id $pid -ErrorAction SilentlyContinue
        $_ + " " + ($process.Name -join '')
    } else {
        $_
    }
}

$connections = Get-NetTCPConnection -LocalPort 8080
$connections | ForEach-Object {
    $process = Get-Process -Id $_.OwningProcess
    $_ | Add-Member -MemberType NoteProperty -Name Process -Value $process.Name
    $_
}

华为无线基本实验(1)旁挂AC直接转发方式

WLAN网络中的报文分为管理报文(控制报文)和数据报文(业务报文)。管理报文通过CAPWAP的控制隧道进行转发;用户数据报文则根据是否通过CAPWAP的数据隧道转发分为隧道转发(又称为“集中转发”)方式、直接转发(又称为“本地转发”)方式和Soft-GRE转发方式。

隧道转发方式是指用户的数据报文到达AP后,需要经过CAPWAP数据隧道封装后发送给AC,然后由AC再转发到上层网络,如图所示。

隧道转发

直接转发方式是指用户的数据报文到达AP后,不经过CAPWAP的隧道封装而直接转发到上层网络,如图1-2所示。

表1-1 隧道转发与直接转发的优缺点

数据转发方式优点缺点
隧道转发AC集中转发数据报文,安全性好,方便集中管理和控制,新增设备部署配置方便,对现网改动小。业务数据必须经过AC转发,报文转发效率比直接转发方式低,AC所受压力大。
直接转发业务数据不需要经过AC转发,报文转发效率高,AC所受压力小。业务数据不便于集中管理和控制,新增设备部署对现网改动大。

配置调整原则

直接转发和隧道转发之间的配置调整,除了VAP下的转发方式的配置调整外,最主要的就是各接口下管理VLAN和业务VLAN的配置调整

  • 直接转发方式下,建议管理VLAN和业务VLAN分别使用不同的VLAN,否则可能导致业务不通。例如,业务VLAN如果和管理VLAN相同,且交换机连接AP的端口配置了PVID为管理VLAN,则下行到用户的报文出连接AP的交换机时业务VLAN会被终结,从而导致业务不通。
  • 隧道转发方式下,管理VLAN和业务VLAN不能配置为同一VLAN,否则会导致MAC漂移,报文转发出错。并且AP和AC之间只能放通管理VLAN,不能放通业务VLAN

实验拓扑

sw1 配置

vlan batch 100 to 105
#
stp disable

interface Vlanif100
ip address 10.1.100.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.102.2
#
interface Vlanif101
#
interface Vlanif102
ip address 10.1.102.1 255.255.255.0
#
interface Vlanif103
ip address 10.1.103.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.102.2
#
interface Vlanif104
ip address 10.1.104.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.102.2
#
interface Vlanif105
ip address 10.1.105.1 255.255.255.0

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100 // 和AC 相连的接口只允许管理vlan通过
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 105
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 100 to 105
//允许业务vlanc通
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 102

ip route-static 0.0.0.0 0.0.0.0 10.1.105.2

Sw2配置

vlan batch 100 103 to 104

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100 to 105
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk pvid vlan 100
port trunk allow-pass vlan 100 to 105
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 104
stp edged-port enable
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk pvid vlan 100
port trunk allow-pass vlan 100 to 105

【思考1】:如果 为隧道转发为什么SW2只创建VLAN100,不用创建VLAN103,104?
解析:因为我们用的是隧道转发,数据到达AC1后,才会打上103,104标记然后发给LSW1
【思考2】:为什么连接AP的接口要打port trunk pvid vlan 100?
解析:交换机收到AP的数据帧打上100的tag发送,把带上100tag的数据帧去掉然后发给AP

AC 配置

vlan batch 100

interface Vlanif100
ip address 10.1.100.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 100 //如果为隧道转发要加上业务vlan ID,业务vlan 要通过AC 转发

第一步 创建AP 组

wlan

ap-group apgoup01

第二步 创建管理模板并关联到AP 组

wlan
regulatory-domain-profile name profile01 //创建域管理模板,名字叫profile01
country-code cn //国家代码选择中国

ap-group name apgroup01
regulatory-domain-profile profile01 //AP组的域管理模板是profile01
Warning: Modifying the country code will clear channel, power and antenna gain c
onfigurations of the radio and reset the AP. Continue?[Y/N]:y


第三步:配置AC的接口源地址
[AC1]capwap source interface Vlanif 100 //AC的接口源地址为VLAN100

第四步:离线导入AP
wlan
ap auth-mode mac-auth //AP的认证模式为MAC认证
ap-id 1 ap-mac 00e0-fc94-4640 //AP的编号和MAC地址
ap-name AP1 //AP的名字为ds
ap-group apgroup01 //AP属于AP组x
ap-id 2 ap-mac 00e0-fc19-42c0 //AP的编号和MAC地址
ap-name AP2 //Ap的名字
ap-group apgroup01 //AP属于AP组x
Warning: This operation may cause AP reset. If the country code changes, it will
clear channel, power and antenna gain configurations of the radio, Whether to c
ontinue? [Y/N]:y
思考:AP的MAC地址是怎么知道的?
读者可以通过在ap上使用命令“display interface Vlanif 1”查看当前ap的mac地址,然后再将mac地址进行绑定。

第五步:配置VLAN业务参数

第1步:创建安全模板

wlan
security-profile name secprofile01 //安全模板的名字叫secprofile01
security wpa-wpa2 psk pass-phrase huawei@123 aes //密码是huawei@123,用AES加密。
quit
第2步:创建SSID模板
wlan
ssid-profile name ssidprofile01 //ssid的模板名字叫ssidprofile01
ssid wifi01 //ssid的名称叫wifi01
quit

第3步:创建VAP模板
wlan
vap-profile name vapprofile01 //vap模板的名字叫vapprofile01
forward-mode direct-forward //转发模式为隧道
service-vlan vlan-id 103 //服务的VLAN为103
security-profile secprofile01//调用安全模板secprofile01
ssid-profile ssidprofile01 //调用SSID模板ssidprofile01
quit
第4步:在AP组里面调用VAP模板
[AC1-wlan-view]ap-group name x
[AC1-wlan-ap-group-x]vap-profile vapprofile01 wlan 1 radio 0 //调用VAP模板
[AC1-wlan-ap-group-x]vap-profile y wlan 1 radio 1 //
思考:radio0 1 2 是什么意思?

DHCP Server 配置

vlan batch 100 to 105
#
stp disable

dhcp enable
#
ip pool vlan103
gateway-list 10.1.103.1
network 10.1.103.0 mask 255.255.255.0
#
ip pool vlan104
gateway-list 10.1.104.1
network 10.1.104.0 mask 255.255.255.0
#
ip pool vlan100
gateway-list 10.1.100.2
network 10.1.100.0 mask 255.255.255.0
option 43 sub-option 2 ip-address 10.1.100.2

interface Vlanif100
dhcp select global
#
interface Vlanif103
dhcp select global
#
interface Vlanif104
dhcp select global

interface GigabitEthernet0/0/0
ip address 10.1.102.2 255.255.255.0
dhcp select global

ip route-static 0.0.0.0 0.0.0.0 10.1.102.1









Index