最小安装的CentOS联网

我用VirtualBox最小化安装了一个CentOS,没找到太好的联网方法,发现借助NAT联网是一个很取巧的方法:

很显然,先要将连接方式设置为“网络地址转换(NAT)”:

然后启动CentOS,用ifup通过脚本启动网络接口:


我们man ifup可以看到如下信息:

ifup(8)                                                         System Administration tools and Daemons                                                         ifup(8)

NAME
       ifup - bring a network interface up

       ifdown - take a network interface down

SYNOPSIS
       ifup CONFIG [boot]

       ifdown CONFIG

DESCRIPTION
       The  ifup  and  ifdown  commands  may  be  used  to  configure  (or, respec- tively, deconfigure) network interfaces based on interface definitions in the files
       /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-<configuration>

       These scripts take one argument normally: the name of the configuration (e.g. eth0). They are called with a second argument of "boot" during the  boot  sequence
       so that devices that are not meant to be brought up on boot (ONBOOT=no, see below) can be ignored at that time.

FILES
       /etc/sysconfig/network

       /etc/sysconfig/network-scripts/ifcfg-<configuration>
              The file defining an interface.

SEE ALSO
       /usr/share/doc/initscripts-*/sysconfig.txt
当然还可以打开ifcfg-<configuration>文件,将"ONBOOT=no"修改为"ONBOOT=yes",然后"service network restart"。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值