ubuntu 容器启动设置网关
可以使用以下命令在 Ubuntu 容器中设置网关:
- 查看当前网络配置:
ifconfig
- 找到容器的网络接口名称,并编辑
/etc/network/interfaces文件,添加以下内容:
auto eth0
iface eth0 inet static
address <容器IP地址>
netmask <子网掩码>
gateway <网关IP地址>
- 重启网络服务:
service networking restart
- 确认网络配置:
ifconfig
以上步骤可以在 Ubuntu 容器中设置网关。
原文地址: http://www.cveoy.top/t/topic/ffPm 著作权归作者所有。请勿转载和采集!