In my BLOG on SuSE Linux at a Glance in View of Rechil Part – 2, I have given a hint that, Network card can be configured manually. It is needed to understand some terms, before I am going to discuss about Network card configuration through Command Line.
Device: Network adapter built into the Linux System
Interface: Use a physical device, a software component creates an interface is also called driver. In Linux OS, network interfaces use a standard naming system such as eth0; eth1…..
Link: It uses the term link to refer to the connection of a device to the network
Address: Must assign an IP address (either static / dynamic) based on ipv4 or ipv6. It is possible to assign more than one address to a network device / NIC
Broadcast: By sending a network packet to the broadcast address, it is possible to reach all hosts in the locally connected network at the same time.
Route: An IP packet takes from the source to the destination host. It also refers to an entry in the routing table of the Kernel.
Normally, YaST helps to configure a network card during / after installation. Using a very simple and built-in tool called ip tool, which helps to configure through Command Line. Of-course you have root privilege to use this tool.
To see ip address setup of all NICs: ip address show or ifconfig (you can see the man page)
Generally, there are three network interfaces (if you have only one NIC):
lo: This is the loopback device, which is available on every Linux OS (it doesn’t matter, what the flavor it is) even when no network adapter is installed. This is a virtual device, that may use to communicate with each other by using IP like 127.0.0.1 or open a browser and type as ping localhost
eth0: The first Ethernet adapter which physically exists and have a IP address as Class A or Class B or Class C
sit0: It is a special kind of virtual device which may be used to encapsulate IPv4 into IPv6 packets.
Remember, generally sit0 is not used in IPv4 network. And IPv6 has different kind of architecture, so it does not use IPv4 procedure.
So, where is IPv5…. There is a story behind that.
IPv5 is an experimental protocol for UNIX based systems. In keeping with standard UNIX release conventions, all odd-numbered versions are considered experimental. It was never intended to be used by the general public.
For example, in IPv4 setup of the device displays as: inet 192.168.1.1/24 brd 255.255.255.0 scope global eth0. Here 192.168.1.1 is IP address follows inet, 255.255.255.0 is broadcast address and the length displays in bits 24 seperated by a / (slash)
To see network attributes type as: ip link show and
the possible attributes are….
UP: It means, the device is turned on
LOOPBACK: It means, this is a virtual network device
BROADCAST: It means, the network device may send packets to all hosts sharing the same network
POINTTOPOINT: It means, the network device may only connected to one other device
MULTICAST: This stands for the network device may send packets to a group of other systems at the same time
PROMISC: It means, the network device listens to all packets on the network. It is useful for network monitoring.
To see additional statistics info about the network device type as: ip –s link show eth0
Note: Provide the device name at the end (eth0), it helps to show output for only one specific device. The section where RX displays information about received packets and the section TX shows information about sent packets.
How to Change Settings of the Installed Network Device….
To assign an IP address type as: ip add 192.168.1.1/24 brd + dev eth0
Here 192.168.1.1 is an assigned IP, you can change as you want. The brd + option sets the broadcast address automatically as determined by the network mask.
To verify the IP address type as: ip address show dev eth0 or hostname –i
To delete IP address, type as: ip address del 192.168.1.1 dev eth0
To change the network device attributes (as I mentioned earlier)
To make enable a network device, type as: ip link set eth0 up or ifup eth0
To make disable a network device, type as: ip link set eth0 down or ifdown eth0
You can use other tool called as “ifcfg”, to use it, type as:
ifcfg eth0 add ipaddr (like 192.168.1.1)
ifcfg eth0 del ipaddr
It is necessary to save the configuration settings in configuration files. The configuration files for network devices are located in /etc/sysconfig/network/. It is must to create one configuration file for every network device. The file name starts as, ifcfg-eth-id- and then followed by hardware address of the network device. It is recommended, configure the network device with YaST first and then make changes in configuration files. The configuration file includes several lines, which can be explained as below….
BOOTPROTO=’static’, this is the way, how the network device is configured either STATIC or DHCP. If it is DHCP, it shows as, BOOTPROTO=’dhcp’
REMOTE_IPADDR=’’, for point-to-point connection, here need to set value for remote IP address
STARTMODE=’onboot’, it determines, how the network device is started. The options are,
auto=determines if the network device starts at boot time i.e. ‘onboot’ or initializes at run time
manual=means, the network device is started manually with ifup
ifplugd=means, when it is plugged or you may set as IFPLUGD_PRIORITY
UNIQUE=‘rBUF.+xOL8ZCSAQC’ _nm_name=’bus-pci-0000:00:0b.0’, for example, it is added by YaST when network device is configured.
BROADCAST=’’; IP ADDR=’192.168.1.1’; NETMASK=’255.255.255.0’; NETWORK=’’, they are all network address configuration
MTU=’’, Maximum Transmission Unit is a value that helps to increase the transmit rate. Default value is 1500 bytes
ETHTOOL_OPTIONS=’’, it is used for querying settings & changing of a network device.
Note: The file /etc/sysconfig/network/ifcfg.template contains a template, which can be used for device configuration files.
Setting up Routing With the ip Tool….
I am focusing only the most common routing scenarios!
To see the current routing table, type as: ip route show
Depending on setup of computer, the content of the routing table varies as,
One route to the local network the system is connected to
One route to the default gateway for all other packets
To add route, type as: ip route add ipaddr/24 dev eth0, ipaddr as your IP address for eg. 10.0.0.100/24.
To set a route to a different network, type as: ip route add 192.168.1.0/24 via 10.0.0.100
That means, all packets for the network 192.168.1.0 are sent through gateway 10.0.0.100
To set a default route, type as: ip route add default via 10.0.0.100
To delete an entry from routing table, type as: ip route delete ipaddr/24
The configuration file is /etc/sysconfig/network/routes
Now writing about the most universally known the command both on Windows and Linux Systems. Yes, it is “PING” but there are several options that few to know….
-c (count) = The no of packets to be sent
-l (interface) = Specifies network interface to be used, if there are several interfaces
-i (seconds) = Specifies no of seconds wait between individual packet shipments
-f (flood ping) = Packets are sent one after another at the same rate. Only root can use
-n (numerical) = To get numerical output of IP address
-t (time to live) = Sets the time to live for packets to be sent
-w (maxwait) = For timeout in seconds
-b (broadcast) = Sends packets to the broadcast address of the network
There is a useful diagnostic tool called “TraceRoute”. It uses UDP packets, which are called “datagrams”. It can be used to collect information about every router on the way to the destination host.
The command is used as include hostname: traceroute abcd (abcd is hostname, u must change with your own). Instead of use hostname, you may use IP address.
Configure Host Name and Name Server….
Set the host name is configured in the file /etc/HOSTNAME (yes, HOSTNAME is capital). This file contains Fully Qualified Domain Name or FQDN. You can change the content of the files manually by opening it on any of your favorite editor like gedit / vi / kate / joe.
The name resolution is configured in the file called /etc/resolv.conf. You can configure up to three name servers manually as stated above.