CENTOS 6 Minimal does not have the Network interfaces up by default

So test drove CentOS  6 Minimum install ..

Only real hiccup till now is :

TUV ( the upstream vendor) aka RHEL decided to disable the network interfaces by default. WTF to that.

A glance at the FAQ  will show the solution :

Here’s my version for multiple interfaces.

 

# cd /etc/sysconfig/network-scripts/  

# sed -i -e ‘s@^ONBOOT=”no@ONBOOT=”yes@’ ifcfg-eth*

Installing SNMP on Centos 6.x

Installing SNMP daemon and tools:

As root

yum -y install net-snmp.i686

yum -y install net-snmp-utils

Once these are installed start the snmp daemon:

/etc/init.d/snmpd start

chkconfig snmpd on

 

This is just the basic install but testing it :

snmpwalk -v 1 -c public -O e 127.0.0.1

For production servers it is advisable to at least change the community name.

All configs are in

/etc/snmp/snmpd.conf

and traps are setup here:

/etc/snmp/snmptrapd.conf

No traps are set by default.

Enjoy !!

Setting hostname

#vim /etc/sysconfig/network

Use something like

HOSTNAME=testarossa.maranello.local

to overwrite the default name and domain of the server.

e.g.

NETWORKING=yes
HOSTNAME=testarossa.maranello.local

To avoid rebooting issue the following :

hostname  testarossa.maranello.local

That will set it for the current  session.

 

 

 

Monitoring connections

To monitor TCP and UDP connections the following command is very useful:

netstat -t -u

to have a continuous update use the watch command:

watch netstat -t -u

There is a much stronger tool for real time analysis called iptraf.

It is quite self explanatory :

at command line run

iptraf

This tool has many functions and is text mode menu ncurses based application really worth learning.

 

Setup default gateway with route command Linux

Display default route

The following three commands display the current routing table:

# route

Output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 ra0
default         dsl-router      0.0.0.0         UG    0      0        0 ra0
# /sbin/route

Output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
191.255.255.0   *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         191.255.255.1   0.0.0.0         UG    0      0        0 eth0

You can use -n option, to display numerical addresses instead of trying to determine symbolic host names (via dns or /etc/hosts file). This is useful if you are trying to determine why the route to your nameserver has vanished.$

#/sbin/route -n

Output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
191.255.255.0   0.0.0.0         255.255.255.0   U     0      0        0 venet0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 venet0
0.0.0.0         191.255.255.1   0.0.0.0         UG    0      0        0 venet0

 

Please note that a destionation entry 0.0.0.0 (or default) is the default gatway. In above example 191.255.255.1 is a default gatway.

Add / setup a new route

The syntax is as follows:
route add default gw {IP-ADDRESS} {INTERFACE-NAME}

Where,

  • IP-ADDRESS: Specify router IP address
  • INTERFACE-NAME: Specify interface name such as eth0

For example if your router IP address is 192.168.1.254 type the following command as the root user:

# route add default gw 192.168.1.254 eth0

OR use hostname such as dsl-router:

# route add default gw dsl-router eth0

Setting route using GUI tools/command under Linux

If you find above command hard to use, consider using GUI tools. If your are using Red Hat/CentOS/Fedora core Linux type following command:

# redhat-config-network

OR

If you are using other Linux distribution use command:

# network-admin

Slash notation lookup table

Total-addresses: how many unique addresses can be represented. To determine how many are available to be assigned to devices you need to subtract 2 from the provided number to allow for the ‘network’ and ‘broadcast’ address. A further one of these may need to be assigned to a router.

Net bits Subnet mask Total-addresses
/20 255.255.240.0 4096
/21 255.255.248.0 2048
/22 255.255.252.0 1024
/23 255.255.254.0 512
/24 255.255.255.0 256
/25 255.255.255.128 128
/26 255.255.255.192 64
/27 255.255.255.224 32
/28 255.255.255.240 16
/29 255.255.255.248 8
/30 255.255.255.252 4

eg:  192.168.1.0/25 would include all address between 192.168.1.0 and 192.168.1.127.

eg: 192.168.1.128/25 would include all address between 192.168.1.128 and 192.168.1.255