VirtualBox安装CentOS8,配置网络

  • 虚拟机设计为桥接方式

  • 查看window的IP
ipconfig

无线局域网适配器 WLAN:
   连接特定的 DNS 后缀 . . . . . . . :
   本地链接 IPv6 地址. . . . . . . . : fe80::808f:d9dc:3310:e222%8
   IPv4 地址 . . . . . . . . . . . . : 192.168.97.10                      <- 
   子网掩码  . . . . . . . . . . . . : 255.255.248.0
   默认网关. . . . . . . . . . . . . : 192.168.100.254
  • 配置网络
cd /etc/sysconfig/network-scripts 
vi ifcfg-enp0s3

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="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="enp0s3"
UUID="2225aff1-649b-4cbd-a586-d0852ec8ed93"
DEVICE="enp0s3"
ONBOOT="yes"          <- 
IPV6_PRIVACY="no"
  • 重启网络服务
systemctl restart network
  • 查看ip
ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:79:cd:1c brd ff:ff:ff:ff:ff:ff
    inet 192.168.96.67/21 brd 192.168.103.255 scope global noprefixroute dynamic enp0s3        <-
       valid_lft 27704sec preferred_lft 27704sec
    inet6 fe80::db4e:70eb:17cf:4d58/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
  • 测试
ping baidu.com

PING baidu.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=51 time=40.9 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=51 time=40.9 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=51 time=45.4 ms
  • yum更新
yum list
yum update
  • 报错
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64
  • 解决方案,注释如下

相关文章

起步 处理器架构,参考 x86是指intel的开发的一种32位指令集...
pscp pscp -P 22 C:\work\test.txt root@192.168.1....
文件处理 ls -a # 显示所有文件 ls -l # 显示详细信息 ls -d...
准备一台电脑(我就用联想拯救者r7000演示) 参考博客制作启...
认识 Linux系统是参考了UNIX系统作为模板开发的,但没有使用...
文件处理命令 以 . 开头的文件是隐藏文件 以 - 开头表示这是...