In order to provide an environment for network experiments in the future, I use VirutalBox to create some hosts. My real host is Ubuntu 14.04 LTS. And ...
In order to provide an environment for network experiments in the future, I use VirutalBox to create some hosts.
My real host is Ubuntu 14.04 LTS.
And I will install some OSs gradually.
CentOS 7 Installation
Download (I use CentOS 7 Minimal)
Network Configuration
Here I use Bridged-Adapter Mode, and I will descript the difference among Bridged-Adapter, Host-only and NAT in Appendix A
Then, let's dirty our hands in the OS:
Configure Gateway:
[root@localhost ~]# vi /etc/sysconfig/network
You should add:
NETWORKING=yes
GATEWAY=192.168.1.1 # configure the gateway IP
Configure DNS:
[root@localhost ~]# vi /etc/resolv.conf
add:
nameserver 192.168.1.1
Configure IP:
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 (here is mine, yours may be difference)
add:
IPADDR=192.168.1.123
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
and modify:
ONBOOT=yes
BOOTPROTO=static (if your local network's DHCP server is available , you can set it to *dhcp*)
Now:
service network restart
Completed!
And you can use
ping www.baidu.com
to test your network.
- Install Desktop Environment
Firstly, you'd better update your OS:
yum update
Then:
yum groupinstall "X Window system"
yum groupinstall gnome
Completed!
And you can use
startx
to turn on the Desktop Environment.
P.S.
There is no ifconfig instruction in CentOS Minimal !
How can that be !!!
Solution:
Determine which packet provides that tool:
yum provides ifconfig
We can see that it is net-tools that provides ifconfig
So,
yum install net-tools
Bingo!
Now you can use it !
(You can do similarly to install other tools)
Here are Some questions:
Appendix A - Difference Among Bridged-Adapter, Host-only And NAT Mode
Learn from here
Virutal Machine always has these three modes.
http://www.cnblogs.com/ggjucheng/archive/2012/08/19/2646007.html
It is too late and I will go to bed.
Write it up tomorrow.
Appendix B - Files About Network Configuration in Linux (RedHat series)
- /etc/sysconfig/network
This file is used to configure hostname and whether to start up:
NETWORKING=yes # means your network will start up
GATEWAY=192.168.1.1
- /etc/sysconfig/network-scripts/ifcfg-enp0s3 (the exact file-name is ifcfg-YOUR-NETWORK-CARD-NAME)
This file is about network configuration:
TYPE=Ethernet # network card type
DEVICE=eth0 # name of network card
ONBOOT=yes # boot or not when OS starts up
BOOTPROTO=static # use Address Protocol: static bootp dhcp
IPADDR=192.168.1.11 # network card's IP
NETMASK=255.255.255.0 # Sub-net mask
GATEWAY=192.168.1.1 # IP of gateway
DNS=10.203.104.41 # DNS server's IP
HWADDR=00:0C:29:13:5D:74 # MAC address
BROADCAST=192.168.1.255 # broadcast address
- /etc/resolv.conf
This file is of DNS configuration.
And it mainly has four keywords:
nameserver # define the IP of DNS server
domain # define local host domain
search # define the seraching list of domain.It can't co-exist with domain entry
sortlist #
- /etc/hosts
This file is the static information about host names (from FHS)
And it seems that the table in /etc/hosts is prior to DNS.
We can test: (I use apache2 on my PC and there is a index.html created by me in the /var/www/html/ directory)
service apache2 start
Then add
192.168.1.103 www.baidu.com
to your /etc/hosts. (Notice that 192.168.1.103 is my local IP)
Then I enter www.baidu.com in your browser's address table: