打赏

ubuntu虚拟机启用双网卡IP配置

首先要登入自己的虚拟机,这里以ubuntu为例。

配置两块网卡,一块eth0为NAT模式,另一块为eth1仅主机模式

 

# 进入网卡配置页面
vi /etc/network/interfaces
复制代码
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.60.202
        netmask 255.255.255.0
        network 192.168.60.0
        broadcast 192.168.60.255
        gateway 192.168.60.2
auto eth1
iface eth1 inet static
        address 192.168.15.202
        netmask 255.255.255.0
        network 192.168.15.0
        broadcast 192.168.15.255
     # 此块网卡不配置网关
复制代码

然后重启网卡即可

/etc/init.d/networking restart

如果ping不通域名

则需要修改此文件

vim /etc/resolv.conf

修改添加一下内容,即可

search localdomain
nameserver 8.8.8.8

 

posted @   不像话  阅读(1254)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 提示词工程——AI应用必不可少的技术
· 字符编码:从基础到乱码解决
· 地球OL攻略 —— 某应届生求职总结
点击右上角即可分享
微信分享提示