1. 程式人生 > >最小安裝的CentOS聯網

最小安裝的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"。