首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >正确/etc/组网/接口脚本的4个以太有一个网桥,两个子网和一个广域网接口

正确/etc/组网/接口脚本的4个以太有一个网桥,两个子网和一个广域网接口
EN

Ask Ubuntu用户
提问于 2018-12-26 21:08:12
回答 1查看 520关注 0票数 0

我的服务器上的最后一个NIC似乎不能正常工作。我有一个HP Proliant服务器与4个NIC目前作为我的家庭路由器。Eth0是我的广域网接口,eth1和eth2是在两个不同的子网上为dhcp服务的。除了服务器上的最后一个网卡eth3之外,一切都很正常。我希望这个桥接到eth1上的第一个子网。我尝试过许多桥接配置,但我做错了什么。这里是我在/etc/networking中找到的接口脚本,请注意,这是它目前的工作方式,并且自从我研究这段时间以来,已经删除了桥接配置,所以eth3现在根本没有安装。

代码语言:javascript
运行
复制
#Loopback lo
auto lo
iface lo inet loopback

#WAN on eth0
auto eth0
iface eth0 inet dhcp

#Subnet 1 on eth1
auto eth1
iface eth1 inet static
    address 192.168.1.1     
    netmask 255.255.255.0
    broadcast 192.168.1.255
    network 192.168.1.0

#subnet 2 on eth2
auto eth2
iface eth2 inet static
    address 10.13.0.1
    netmask 255.255.255.240
    broadcast 10.13.0.15
    network 10.13.0.0

#alias on eth1:0
auto eth1:0
iface eth1:0 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    broadcast 192.168.1.255
    network 192.168.1.0

Alias是为我的内部网络服务的for服务器,它也只是dnsmasq使用端口53 on的一张脸。

UbuntuServer18.04LTS,Netplan被禁用,使用ifupdown。dhcp -服务器服务dhcp。

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2019-02-08 05:56:47

连接许多服务(如dhcp、dns或iptables等)所使用的接口的最快和最简单的路径。重命名接口(更改网络接口名Ubuntu 16.04)。然后继续使用原始接口名命名桥。这对我在linux上运行的所有东西都有效。它不优雅,但嘿,总比重新设置一切。下面是我当前的脚本,从问题中的脚本将eth1重命名为phys1,现在桥名为eth1:

代码语言:javascript
运行
复制
#Loopback lo
auto lo
iface lo inet loopback

#WAN on eth0
auto eth0
iface eth0 inet dhcp

#phys1
auto phys1
iface phys1 inet manual

#Subnet 1 bridge interface on eth1
auto eth1
iface eth1 inet static
    address 192.168.1.1
    netmask 255.255.255.0
    broadcast 192.168.1.255
    network 192.168.1.0
    bridge_ports phys1 eth3

#subnet 2 on eth2
auto eth2
iface eth2 inet static
    address 10.13.0.1
    netmask 255.255.255.240
    broadcast 10.13.0.15
    network 10.13.0.0

#eth3
auto eth3
iface eth3 inet manual

#alias on eth1:0
auto eth1:0
iface eth1:0 inet static
    address 192.168.1.2
    netmask 255.255.255.0
    broadcast 192.168.1.255
    network 192.168.1.0

我个人不喜欢netplan,所以我希望这能帮助任何有类似品味的人。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1104734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档