day14-增补静态网卡设置

[复制链接]
发表于 2025-12-2 15:29:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
修改网络模式,修改静态ip,动态ip获取方式

检察当前的上网信息

1.确保你的呆板,是毗连的网络的,是插上了网线的。(模拟了物理服务器的软件是什么?看你的假造的呆板(vmware))
2.进入体系,检察软件的网络设置了
  1. 进入网卡配置文件目录
  2. [root@yuanlai-0224 ~]# cd /etc/sysconfig/network-scripts/
  3. [root@yuanlai-0224 network-scripts]#
  4. [root@yuanlai-0224 network-scripts]#
  5. [root@yuanlai-0224 network-scripts]# ll
  6. 总用量 248
  7. -rw-r--r--. 1 root root   310 2月  25 15:12 ifcfg-ens33
  8. -rw-r--r--. 1 root root   254 1月   3 2018 ifcfg-lo
  9. lrwxrwxrwx. 1 root root    24 2月  25 15:05 ifdown -> ../../../usr/sbin/ifdown
  10. -rwxr-xr-x. 1 root root   654 1月   3 2018 ifdown-bnep
  11. -rwxr-xr-x. 1 root root  6569 1月   3 2018 ifdown-eth
  12. -rwxr-xr-x. 1 root root  6190 4月  11 2018 ifdown-ib
  13. -rwxr-xr-x. 1 root root   781 1月   3 2018 ifdown-ippp
  14. -rwxr-xr-x. 1 root root  4540 1月   3 2018 ifdown-ipv6
  15. lrwxrwxrwx. 1 root root    11 2月  25 15:05 ifdown-isdn -> ifdown-ippp
  16. -rwxr-xr-x. 1 root root  2102 1月   3 2018 ifdown-post
  17. -rwxr-xr-x. 1 root root  1068 1月   3 2018 ifdown-ppp
  18. -rwxr-xr-x. 1 root root   870 1月   3 2018 ifdown-routes
  19. -rwxr-xr-x. 1 root root  1456 1月   3 2018 ifdown-sit
  20. -rwxr-xr-x. 1 root root  1621 3月  18 2017 ifdown-Team
  21. -rwxr-xr-x. 1 root root  1556 3月  18 2017 ifdown-TeamPort
  22. -rwxr-xr-x. 1 root root  1462 1月   3 2018 ifdown-tunnel
  23. lrwxrwxrwx. 1 root root    22 2月  25 15:05 ifup -> ../../../usr/sbin/ifup
  24. -rwxr-xr-x. 1 root root 12415 1月   3 2018 ifup-aliases
  25. -rwxr-xr-x. 1 root root   910 1月   3 2018 ifup-bnep
  26. -rwxr-xr-x. 1 root root 13442 1月   3 2018 ifup-eth
  27. -rwxr-xr-x. 1 root root 10114 4月  11 2018 ifup-ib
  28. -rwxr-xr-x. 1 root root 12075 1月   3 2018 ifup-ippp
  29. -rwxr-xr-x. 1 root root 11893 1月   3 2018 ifup-ipv6
  30. lrwxrwxrwx. 1 root root     9 2月  25 15:05 ifup-isdn -> ifup-ippp
  31. -rwxr-xr-x. 1 root root   650 1月   3 2018 ifup-plip
  32. -rwxr-xr-x. 1 root root  1064 1月   3 2018 ifup-plusb
  33. -rwxr-xr-x. 1 root root  4981 1月   3 2018 ifup-post
  34. -rwxr-xr-x. 1 root root  4154 1月   3 2018 ifup-ppp
  35. -rwxr-xr-x. 1 root root  2001 1月   3 2018 ifup-routes
  36. -rwxr-xr-x. 1 root root  3303 1月   3 2018 ifup-sit
  37. -rwxr-xr-x. 1 root root  1755 3月  18 2017 ifup-Team
  38. -rwxr-xr-x. 1 root root  1876 3月  18 2017 ifup-TeamPort
  39. -rwxr-xr-x. 1 root root  2711 1月   3 2018 ifup-tunnel
  40. -rwxr-xr-x. 1 root root  1836 1月   3 2018 ifup-wireless
  41. -rwxr-xr-x. 1 root root  5419 1月   3 2018 init.ipv6-global
  42. -rw-r--r--. 1 root root 19948 1月   3 2018 network-functions
  43. -rw-r--r--. 1 root root 31027 1月   3 2018 network-functions-ipv6
  44. [root@yuanlai-0224 network-scripts]#
复制代码
3.编辑网卡的设置文件
  1. 编辑网卡配置文件
  2. [root@yuanlai-0224 network-scripts]# ls |grep ens33
  3. ifcfg-ens33
复制代码

4.须要关闭,禁用centos7在图形化下,设置的网络服务,同时管理wifi和有线
服务名  NetworkManager
systemctl stop NetworkManager # 关闭
systemctl is-enabled NetworkManager  # 检察是否开机自启
# 克制开机运行
systemctl disbale NetworkManager
 5.启动管理网络的服务
systemctl start network
systemctl  status network # 检察网络服务状态
6.通过ip下令,检察ip地点信息
ifconfig
默认的dhcp动态获取ip

不消操纵了,直接启动network服务即可
systemctl start netowrk 
改为静态ip的步调

1.检察你的vmware假造网卡,网络环境是什么(NAT)
桥接
    你的linux接纳桥接,便是你去这个路由器分配的局域网中,拿走一个ip,便是讲堂多了一个门生
    
NAT
    网络地点转换
    ip地点映射表
    vmnet8先找到你的假造网卡 
假造机是怎样上网的

 
给假造机设置静态ip,须要根据如上设置来,找到哪些信息

  •         确认你所在的网段环境 (10.96.0.xx)
  •         确认网关
  •         填写dns服务器地点
  •         修改网卡为 static模式
  1. [root@yuanlai-0224 network-scripts]# cat ifcfg-ens33
  2. TYPE="Ethernet"
  3. PROXY_METHOD="none"
  4. BROWSER_ONLY="no"
  5. # 你要根据你的网络环境修改的信息如下这几个
  6. BOOTPROTO="static"
  7. IPADDR="10.96.0.77"
  8. NETMASK="255.255.255.0"
  9. GATEWAY="10.96.0.2"
  10. DNS1='114.114.114.114'
  11. DNS2='115.115.115.115'
  12. DEFROUTE="yes"
  13. IPV4_FAILURE_FATAL="no"
  14. IPV6INIT="yes"
  15. IPV6_AUTOCONF="yes"
  16. IPV6_DEFROUTE="yes"
  17. IPV6_FAILURE_FATAL="no"
  18. IPV6_ADDR_GEN_MODE="stable-privacy"
  19. NAME="ens33"
  20. UUID="c00d6dd2-38dd-4f08-ba63-44333a825502"
  21. DEVICE="ens33"
  22. ONBOOT="yes"
复制代码
5.修改设置文件,肯定要重启网络服务
  1. systemctl restart network
复制代码
6.重新使用新的ip地点,试试毗连
  1. [root@yuanlai-0224 ~]#
  2. [root@yuanlai-0224 ~]# ip addr
  3. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  4.     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  5.     inet 127.0.0.1/8 scope host lo
  6.        valid_lft forever preferred_lft forever
  7.     inet6 ::1/128 scope host
  8.        valid_lft forever preferred_lft forever
  9. 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
  10.     link/ether 00:0c:29:c2:f1:f1 brd ff:ff:ff:ff:ff:ff
  11.     inet 10.96.0.77/24 brd 10.96.0.255 scope global noprefixroute ens33
  12.        valid_lft forever preferred_lft forever
  13.     inet6 fe80::409b:ebcf:7ff7:7764/64 scope link noprefixroute
  14.        valid_lft forever preferred_lft forever
  15. 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
  16.     link/ether 52:54:00:2e:55:62 brd ff:ff:ff:ff:ff:ff
  17.     inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
  18.        valid_lft forever preferred_lft forever
  19. 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
  20.     link/ether 52:54:00:2e:55:62 brd ff:ff:ff:ff:ff:ff
  21. [root@yuanlai-0224 ~]#
  22. [root@yuanlai-0224 ~]#
  23. [root@yuanlai-0224 ~]# ping baidu.com
  24. PING baidu.com (220.181.38.148) 56(84) bytes of data.
  25. 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=8.80 ms
  26. 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=7.45 ms
  27. 64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=7.10 ms
复制代码
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表