ubuntu桥接网络配置

本文介绍Linux网络配置方法。先设置物理机、虚拟机桥接模式,接着更改本地ip配置、设置DNS文件、修改启动脚本,然后重启配置文件,若重启网络后仍有问题,可尝试使用ifconfig eth0 down/up命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

先设置物理机、虚拟机的桥接模式,

参考文章:https://blog.youkuaiyun.com/tiramisu_L/article/details/80557772

https://blog.youkuaiyun.com/wumumang/article/details/54173075

再进行以下操作

1.更改本地ip配置 vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.7.112.130
netmask 255.255.255.0
gateway 10.7.112.254
dns-nameservers 10.1.7.97 10.1.7.98

2.设置DNS文件 vi /etc/resolv.conf(如上一步中配置了dns-nameservers则这里会自动配置)

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.1.7.97
nameserver 10.1.7.98

3.修改启动脚本 vi /etc/rc.local(可不修改)

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

4.重启配置文件 /etc/init.d/networking restart

5.如重启网络后还不行可试下ifconfig eth0 down/up

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值