How to Check Routing Tables on Fedora 16

In Linux operating system, routing table is used by the computer networks or servers to stores the routes of the destinations that responsible for forwarding. Routing tables contain a list of IP addresses and each of IP addresses identifies a network gateway. In this post, i will show you three ways to check and display the linux Routing Table on Fedora 16 server.

By using Route Command :
Route manipulates the kernel’s IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured.

By using netstat command :
Netstat prints information about the Linux networking subsystem such as network connections, routing tables and interface statistics.

1. Display routing table using “route -n” :

[root@fedora16 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 p3p1
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 p3p1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 p3p1

2. Display routing table using “netstat -rn” :

[root@fedora16 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 p3p1
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 p3p1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 p3p1

3. Display routing table using “ip route show” :

[root@fedora16 ~]# ip route show
default via 192.168.1.1 dev p3p1
169.254.0.0/16 dev p3p1  scope link  metric 1002
192.168.1.0/24 dev p3p1  proto kernel  scope link  src 192.168.1.47

How to Install system-config-firewall-tui on Linux CentOS 6.2 Server

In this post, i will guide you on how to install system-config-firewall-tui on linux CentOS 6.2 server. This steps may working on other version such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5, CentOS 5.6, CentOS 5.7, CentOS 6.0 and CentOS 6.1. system-config-firewall is a graphical user interface for setting basic firewall rules. For those who are not familiar in command line iptables, system-config-firewall-tui is the solution for them. Follow this steps to install and use system-config-firewall-tui on linux CentOS 6.2 server.

1. Perform yum install using the following command :

yum install system-config-firewall-tui -y
[root@centos62 ~]# yum install system-config-firewall-tui -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.hostemo.com
 * epel: ftp.cuhk.edu.hk
 * extras: mirrors.hostemo.com
 * updates: mirrors.hostemo.com
CentOS6.2-Repository                                                         | 4.0 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package system-config-firewall-tui.noarch 0:1.2.27-5.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                          Arch         Version             Repository                  Size
====================================================================================================
Installing:
 system-config-firewall-tui       noarch       1.2.27-5.el6        CentOS6.2-Repository        37 k

Transaction Summary
====================================================================================================
Install       1 Package(s)

Total download size: 37 k
Installed size: 59 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : system-config-firewall-tui-1.2.27-5.el6.noarch                                   1/1

Installed:
  system-config-firewall-tui.noarch 0:1.2.27-5.el6

Complete!

2. To start configure your iptables using “system-config-firewall-tui”, run the following command :

[root@centos62 ~]# system-config-firewall-tui

system-config-firewall-tui
3. After any changes, please restart your iptables using this command :

[root@centos62 ~]# service iptables restart

or

[root@centos62 ~]# /etc/init.d/iptables restart

How to Configure Static Routes on CentOS 6.2

Routing is the process of selecting paths in a network along which to send network traffic. It’s not necessary to configure Static Routes on Red Hat Enterprise Linux servers or CentOS servers since routing will be configured on routing devices such as routers, bridges, gateways, firewalls and switches. However, if static routes are required they can be configured for each interface. This can be useful when you have multiple network interfaces in different subnets such as eth0, eth1 and eth2. The following static route commands has been tested on Linux CentOS 6.2 server.

Display routing table using the following command :

[root@centos62 ~]# netstat -rn

This command will add the Static Routes on CentOS 6.2 server. For example network 192.168.2.0/24 available via 192.168.2.1 on device eth1 :

[root@centos62 ~]# ip route add 192.168.2.0/24 via 192.168.2.1 dev eth1

Alternatively, you can use this command :

[root@centos62 ~]# route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1 dev eth1

Note : The drawback of using these two commands is it will forget the static routes when server rebooted.

How to Install system-config-network on CentOS 6.2

In this post, i will share on how to install GUI for network configuration on CentOS 6.2. The mentioned network GUI tools will edit the system configuration files. The result using this GUi is the same with change of configuration files directly. Assume that you have installed minimal installation type CentOS 6.2 and has setup your own local yum repository. You can use internet CentOS yum repository instead if you have direct internet connection to your server.

How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on CentOS 6.2

Without network Gui installed, you will get the following error.

    [root@centos6 ~]# system-config-network
    -bash: /usr/sbin/system-config-network: No such file or directory
    

Please note that you must be the root to install the package.

    [root@centos6 html]# yum install system-config-network-tui
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: centos.ipserverone.com
     * extras: centos.ipserverone.com
     * updates: centos.ipserverone.com
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package system-config-network-tui.noarch 0:1.6.0.el6.2-1.el6 will be installed
    --> Processing Dependency: usermode for package: system-config-network-tui-1.6.0.el6.2-1.el6.noarch
    --> Processing Dependency: python-iwlib for package: system-config-network-tui-1.6.0.el6.2-1.el6.noarch
    --> Processing Dependency: python-ethtool for package: system-config-network-tui-1.6.0.el6.2-1.el6.noarch
    --> Processing Dependency: pciutils for package: system-config-network-tui-1.6.0.el6.2-1.el6.noarch
    --> Processing Dependency: dbus-python for package: system-config-network-tui-1.6.0.el6.2-1.el6.noarch
    --> Running transaction check
    ---> Package dbus-python.i686 0:0.83.0-6.1.el6 will be installed
    ---> Package pciutils.i686 0:3.1.4-11.el6 will be installed
    ---> Package python-ethtool.i686 0:0.6-1.el6 will be installed
    --> Processing Dependency: libnl.so.1 for package: python-ethtool-0.6-1.el6.i686
    ---> Package python-iwlib.i686 0:0.1-1.2.el6 will be installed
    --> Processing Dependency: wireless-tools >= 28-0.pre8.5 for package: python-iwlib-0.1-1.2.el6.i686
    --> Processing Dependency: libiw.so.29 for package: python-iwlib-0.1-1.2.el6.i686
    ---> Package usermode.i686 0:1.102-3.el6 will be installed
    --> Running transaction check
    ---> Package libnl.i686 0:1.1-14.el6 will be installed
    ---> Package wireless-tools.i686 1:29-5.1.1.el6 will be installed
    --> Processing Dependency: crda for package: 1:wireless-tools-29-5.1.1.el6.i686
    --> Running transaction check
    ---> Package crda.i686 0:1.1.1_2010.11.22-1.el6 will be installed
    --> Processing Dependency: iw for package: crda-1.1.1_2010.11.22-1.el6.i686
    --> Running transaction check
    ---> Package iw.i686 0:0.9.17-4.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===============================================================================================
     Package                     Arch     Version                     Repository              Size
    ===============================================================================================
    Installing:
     system-config-network-tui   noarch   1.6.0.el6.2-1.el6           CentOS6.2-Repository   1.2 M
    Installing for dependencies:
     crda                        i686     1.1.1_2010.11.22-1.el6      CentOS6.2-Repository    23 k
     dbus-python                 i686     0.83.0-6.1.el6              CentOS6.2-Repository   196 k
     iw                          i686     0.9.17-4.el6                CentOS6.2-Repository    34 k
     libnl                       i686     1.1-14.el6                  CentOS6.2-Repository   123 k
     pciutils                    i686     3.1.4-11.el6                CentOS6.2-Repository    83 k
     python-ethtool              i686     0.6-1.el6                   CentOS6.2-Repository    28 k
     python-iwlib                i686     0.1-1.2.el6                 CentOS6.2-Repository    14 k
     usermode                    i686     1.102-3.el6                 CentOS6.2-Repository   187 k
     wireless-tools              i686     1:29-5.1.1.el6              CentOS6.2-Repository    92 k
    
    Transaction Summary
    ===============================================================================================
    Install      10 Package(s)
    
    Total download size: 2.0 M
    Installed size: 7.2 M
    Is this ok [y/N]: y
    Downloading Packages:
    -----------------------------------------------------------------------------------------------
    Total                                                          7.6 MB/s | 2.0 MB     00:00
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : libnl-1.1-14.el6.i686                                                      1/10
      Installing : iw-0.9.17-4.el6.i686                                                       2/10
      Installing : crda-1.1.1_2010.11.22-1.el6.i686                                           3/10
      Installing : 1:wireless-tools-29-5.1.1.el6.i686                                         4/10
      Installing : python-iwlib-0.1-1.2.el6.i686                                              5/10
      Installing : python-ethtool-0.6-1.el6.i686                                              6/10
      Installing : usermode-1.102-3.el6.i686                                                  7/10
      Installing : dbus-python-0.83.0-6.1.el6.i686                                            8/10
      Installing : pciutils-3.1.4-11.el6.i686                                                 9/10
      Installing : system-config-network-tui-1.6.0.el6.2-1.el6.noarch                        10/10
    
    Installed:
      system-config-network-tui.noarch 0:1.6.0.el6.2-1.el6
    
    Dependency Installed:
      crda.i686 0:1.1.1_2010.11.22-1.el6             dbus-python.i686 0:0.83.0-6.1.el6
      iw.i686 0:0.9.17-4.el6                         libnl.i686 0:1.1-14.el6
      pciutils.i686 0:3.1.4-11.el6                   python-ethtool.i686 0:0.6-1.el6
      python-iwlib.i686 0:0.1-1.2.el6                usermode.i686 0:1.102-3.el6
      wireless-tools.i686 1:29-5.1.1.el6
    
    Complete!
    

The GUI Interface will look like this:

CentOS 6.2
CentOS 6.2