最小安装的CentOS联网

来源:互联网 发布:手机淘宝好评能修改吗 编辑:程序博客网 时间:2024/06/05 19:48

我用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 downSYNOPSIS       ifup CONFIG [boot]       ifdown CONFIGDESCRIPTION       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
原创粉丝点击