网络-sdn(2)

vlan


  • 缺省vlan

vlan三种接口的区别

1、接口的作用:添加和剥离标签
2、交换机内部都是带有tag的数据包

access口

1、接口收到不带tag的包会自动打上tag=pvid
2、接口收到带tag的包会判断该包的tag与access口设置的pvid是否相同
3、交换机内部都是带标签的
4、都是在交换机上的某个口打上pvid

架构

dis current-configuration 查看所有接口配置
int g0/0/1
dis this
dis vlan
dis port vlan  # 查看接口的link type
修改端口的类型
port link-type access
port default vlan 10

抓包

vlan tag

trunk接口

1.一般用于连接交换机的
2、多行道

trunk配置



一个是pvid一个是允许通过的vlan标签

hybrid接口


vlan-pvid

linux bridge实现vlan

1、三层交换机可以配ip地址

system-view
vlan 10
q
int vlanif 10 
ip a 1.1.1.1 24

2、linux brige vlan
发出的数据包带有vlan的包
veth10,veth20指的ip
3001,3002代表vlan标签

ntpdate
apt install vlan
ip netns list
ip netns delete 存在的
modprobe 8021q 加载vlan模块
sh -c "grep -q 8021 /etc/modules||echo 8021q>>/etc/modules"
brctl show   查看网桥
brctl delbr br-test-vlan  #删除之前的,需要先ifconfig br-test-vlan down
brctl addbr br-test-vlan   #默认id8000.0000000,起来之后=8000.xxxxxxxxx
ip link a veth01 type veth peer name veth10  创建虚拟网卡对
ip link a veth03 type veth peer name veth30
ifconfig veth02 down
brctl addif  br-test-vlan veth01  #一端接到网桥上
brctl addif  br-test-vlan veth03
ip netns a ns1
ip netns a ns2  
ip netns exec ns1 ifconfig 
ip link set veth10 netns ns1
ip link set veth30 netns ns2

# 启动设备
ip link set veth01 up 
ip netns exec ns1 ip link set veth10 up
ip netns exec ns2 ip link set veth30 up

vxlan

vxlan数据包

udp端口4789,linux8472
1、非标准端口的vxlan数据包wireshark需要指定数据包格式,右键选vxlan格式

vxlan介绍

1、很大的二层交换

2、mac in udp 基于流的负载分担(数据中心)

docker vxlan网络fannel

vxlan搭建


配置ce12800交换机实现vxlan

1.每一步操作都要commit

sysname ce5
int g1/0/0
undo shutdown
commit 
interface g1/0/0.10 
undo shutdown
interface g1/0/0.10 mode l2
commit
dis this
#

#interface ge1/0/0.10  mode l2
#
encapsulation dot1q vid 10
commit 
bridge-domain 10  bd域中定义的vni的值
commit 
vxlan vni 10  vni2的12次方
commit 
dis this

关闭 交换口

undo portswitch
ip a 10.1.1.1 24
undo shutdown
commit
disthis

在ce设备配置环回口,配置ospf学习路由(underlay)
在ce设备创建tunnel vni 10 hean-end peer-list 1.1.1.1(对端)
ospf隧道学习到对方的路由

微信:jinmuqq222
原文地址:https://www.cnblogs.com/jinmuqq222/p/14624040.html