بسم الله الرحمن الرحيم
In the Name of Allah. The Most gracious, The Most Merciful
Synopsis:
A short tutorial on how to configure network settings on CentOS 6.3 machine.
Assumptions and Prerequisites:
- OS: CentOS 6.3 x64
- Server Name: mujahid
- Subnet: 192.168.1.0/24
- Server IP: 192.168.1.20
- Subnet Mask: 255.255.255.0
- DNS IP: 192.168.1.15
- Gateway IP: 192.168.1.1
- Domain: houseofjaleel.com.au
- Network Device/Interface: eth0
- Text Editor: vi
- Firewall (IPTables) is disabled.
- SELinux is disabled.
- '#' - Script Comment.
- This machine is a Server; therefore has a fixed IP settings. It is not assigned any network settings from any DHCP or BOOTP service.
Step-by-Step Instructions:
1. Create the network configuration file /etc/sysconfig/network-scripts/ifcfg-eth0 with the following configurations and save it.
DEVICE="eth0" # Device name
HWADDR="00:0C:29:7D:A0:62" # eth0's MAC address. This may be different on your machine.
NM_CONTROLLED="no" # Settings are not controlled by the Network Manager service.
BOOTPROTO="none" # This device does not receive network settings from any dhcp service on the network.
ONBOOT="yes" # Service starts at boot time.
TYPE="Ethernet" # Device type is of Ethernet.
IPADDR="192.168.1.20" # IP Address of this Network device.
NETMASK="255.255.255.0" # Subnet Mask
GATEWAY="192.168.1.1" # IP Address to access the Internet (usually it's a Router).
DNS1="192.168.1.15" # IP Address of the machine hosting the DNS on the LAN.
DOMAIN="houseofjaleel.com.au" # Name of the Domain this server belongs to. Omit if no domain configured on Network.
IPV6INIT="no" # ipv6 is not enabled on this server machine.
USERCTL="no" # Except for root user, users can't alter network setting for this device.
Clean (without comments) version of the file /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:0C:29:7D:A0:62"
NM_CONTROLLED="no"
BOOTPROTO="none"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR="192.168.1.20"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1="192.168.1.15"
DOMAIN="houseofjaleel.com.au"
IPV6INIT="no"
USERCTL="no"
2. Restart Network service.
# /etc/rc.d/init.d/network restart
3. Enable Network Service to start at boot time.
# chkconfig network on
4. Check to see if network settings have been loaded from the configuration file for 'eth0'.
# ifconfig
5. Disable ipv6 device driver on this server machine from loading at boot time.
# echo "install ipv6 /bin/true" > /etc/modprobe.d/disable-ipv6.conf
6. Restart server.
# reboot
7. Login as root and check network settings. It should show that there is no "inet6" setting anymore.
# ifconfig
Conclusion:
Change the "DNS1" configuration to "127.0.0.1" or "192.168.1.20", if DNS is configured on the local machine.
Use 'DNS2' to add a secondary DNS host (eg. DNS2="192.168.1.16").
IPV6 is outside of the scope of this tutorial.
No comments:
Post a Comment