桥连固定ip、修改主机名

我的未来我决定 提交于 2019-12-31 21:20:25

*****vm虚拟机设置桥接模式+ubuntu设置固定ip

1.查看虚拟机网卡:
  ip addr

2.查看ddns:
  cat /etc/resolv.conf

3.修改配置
  vim /etc/network/interfaces

  auto ens33 //其中eth0为虚拟网卡的名字
  iface ens33 inet static // 设为静态
  address 192.168.28.211 //这个ip地址可以设的大一些
  netmask 255.255.255.0 //掩码:可以通过ifconfig查看
  gateway 192.168.28.1 //网关:可以"netstat -rn"查看


3.设置dns服务器:
  vim /etc/resolvconf/resolv.conf.d/base

  nameserver 192.168.28.1
  nameserver 114.114.114.114

4.重启:
  init 6

5.查看IP,测试网络:
  ifconfig
  ping baidu.com

*****修改主机

1.修改主机名称:
  vim /etc/hostname

  ubuntu-test
2.追加主机与IP的绑定:
  vim /etc/hosts

 

  ubuntu-test  192.168.28.210

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!