请问下多VLAN如何设置?

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
3038922
帖子: 11
注册时间: 2020-04-28 17:39
系统: 20.04 LTS
送出感谢: 6 次
接收感谢: 0

请问下多VLAN如何设置?

#1

帖子 3038922 » 2021-10-19 9:29

这是我原来的.
```
# /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp1s0f2:
dhcp4: no
enp1s0f3:
dhcp4: no
bonds:
bond0:
interfaces: [enp1s0f2, enp1s0f3]
addresses: [10.255.0.99/24]
gateway4: 10.255.0.2
nameservers:
addresses: [192.168.250.3]
parameters:
mode: 802.3ad
transmit-hash-policy: layer3+4
mii-monitor-interval: 1
```
然后我需要在 vlan12 vlan 15上分别虚拟出一个ip 10.253.12.99 和10.253.15.99
我按教程又新建了.但似乎没虚拟出来.
我交换机已经设置好了
```
interface Bridge-Aggregation99
description to_ubuntu_server
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 12 15 tagged
port hybrid vlan 10 13 to 14 16 to 17 1000 untagged
port hybrid pvid vlan 1000
link-aggregation mode dynamic
stp edged-port enable
```

这是我新建的.但是我一旦输入IP地址就会报错了 说要新增啥路由表
```报错内容
** (generate:749871): WARNING **: 08:46:04.495: Problem encountered while validating default route consistency.Please set up multiple routing tables and use `routing-policy` instead.
Error: Conflicting default route declarations for IPv4 (table: main, metric: default), first declared in vlan12 but also in bond0
```

我不明白brige到底干嘛的....直接跟交换机一样直接设置几个VLAN行不行的?

```新建的brage_vlan.yaml
network:
version: 2
renderer: networkd
vlans:
vlan12:
accept-ra: no
id: 12
link: bond0
# addresses: [10.253.12.99/24]
# gateway4: 10.253.12.1
# nameservers:
# addresses: [192.168.250.3]
vlan15:
accept-ra: no
id: 15
link: bond0
# addresses: [10.253.15.99/24]
# gateway4: 10.253.15.1
# nameservers:
# addresses: [192.168.250.3]
bridges:
br-vlan12:
interfaces: [vlan12]
# addresses: [10.253.12.99/24]
# gateway4: 10.253.12.1
# nameservers:
# addresses: [192.168.250.3]
# parameters:
# stp: false
# forward-delay: 0
br-vlan15:
interfaces: [vlan15]
# addresses: [10.253.15.99/24]
# gateway4: 10.253.15.1
# nameservers:
# addresses: [192.168.250.3]
# parameters:
# stp: false
# forward-delay: 0
```
回复