当前位置: 代码迷 >> 综合 >> Mac VMware fusion Centos7网络配置
  详细解决方案

Mac VMware fusion Centos7网络配置

热度:37   发布时间:2023-12-05 19:23:41.0

 

 

 

 

 

Macbook本身的配置【系统偏好设置】-【网络】- 选中【Wi-Fi】项(如果您是WIFI上网请选择此项)- 点右侧【高级】

  选择【TCP/IP】选项卡,记录好【子网掩码】、【路由器】地址、DNS选项卡下的DNS服务器地址(如果DNS服务器地址没有配置,也可以给配置个8.8.8.8或者114.114.114.114)

  比如:

   路由器地址:192.168.0.1

     子网掩码:255.255.255.0

     DNS:114.114.114.114 (如果mac本上为空,也可以配置为8.8.8.8或者114.114.114.114)

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static" # 使用静态IP地址,默认为dhcp
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="10da992c-7c2e-454d-a12d-a0b5fd95bd78"
DEVICE="ens33"
ONBOOT="yes" #是否开机启用
DNS1="192.168.5.1"  # DNS服务器
DNS2="192.168.0.1"  # DNS服务器
IPADDR="192.168.0.100"  # 设置的静态IP地址
NETMASK="255.255.255.0" # 子网掩码
PREFIX=24
GATEWAY="172.16.57.2" # 网关地址
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no

 

 

 

Linux查询子网掩码网关DNS

原文:https://blog.csdn.net/Zha_PenFee/article/details/51224372 

##查询IP和子网掩码
[root@pfzhang3 ~]# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:0C:29:33:2B:D8  
          inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe33:2bd8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:335 errors:0 dropped:0 overruns:0 frame:0
          TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45418 (44.3 KiB)  TX bytes:15915 (15.5 KiB)


lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2448 (2.3 KiB)  TX bytes:2448 (2.3 KiB)


pan0      Link encap:Ethernet  HWaddr 1A:36:CD:39:B5:A1  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

 

 


##查询默认网关
[root@pfzhang3 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
[root@pfzhang3 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0

 


##查询DNS
[root@pfzhang3 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 61.132.163.68
nameserver 202.102.213.68

 


##配置网卡参数
[root@pfzhang3 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:33:2B:D8
TYPE=Ethernet
UUID=a4a40b33-4da4-4cfd-aaa0-2cd60bb2329c
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.0.102
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=61.132.163.68
DNS2=202.102.213.68

 


##重启网卡服务
[root@pfzhang3 ~]# service network restart
Shutting down interface eth0:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2
                                                           [  OK  ]  

 

 

vm网络为NAT模式设置

转:https://blog.csdn.net/qq_39597203/article/details/80556608

  相关解决方案