0% found this document useful (0 votes)
136 views7 pages

Linux Network Configuration Guide

The document discusses Linux networking configuration files and commands. It describes key networking configuration files like /etc/hosts, /etc/resolv.conf, /etc/sysconfig/network, and /etc/sysconfig/networking/scripts/ifcfg-eth0 that contain host, DNS, and interface settings. It also provides examples of commands to check network interfaces, IP addresses, routing tables, and to scan ports like nmap.

Uploaded by

manoj22490
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views7 pages

Linux Network Configuration Guide

The document discusses Linux networking configuration files and commands. It describes key networking configuration files like /etc/hosts, /etc/resolv.conf, /etc/sysconfig/network, and /etc/sysconfig/networking/scripts/ifcfg-eth0 that contain host, DNS, and interface settings. It also provides examples of commands to check network interfaces, IP addresses, routing tables, and to scan ports like nmap.

Uploaded by

manoj22490
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Linux Networking

Network Configuration Files 1. /etc/hosts IP address local name resolve configuration file alias

hostname

Reference man hosts [root@server1 Desktop]# cat /etc/hosts [Link] localhost [Link] localhost4 localhost4.localdomain4 ::1 localhost [Link] localhost6 localhost6.localdomain6 [Link] [Link] server1 2. /etc/[Link] Reference man [Link] [root@server1 Desktop]# cat /etc/[Link] # Generated by NetworkManager search [Link] nameserver [Link] 3. /etc/sysconfig/network [root@server1 Desktop]# cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=[Link] NISDOMAIN=nisserver 4. /etc/sysconfig/networking/scripts/ifcfg-eth0 cat /etc/sysconfig/network-scripts/ifcfg-eth0 or [root@server1 Desktop]# cat /etc/sysconfig/networking/devices/ifcfg-eth0 DEVICE=eth0 NM_CONTROLLED=yes ONBOOT=yes IPADDR=[Link] BOOTPROTO=none NETMASK=[Link] TYPE=Ethernet GATEWAY=[Link] DNS1=[Link] IPV6INIT=no USERCTL=no HWADDR=[Link] DNS server resolver configuration file

PREFIX=24 DEFROUTE=yes IPV4_FAILURE_FATAL=yes NAME="System eth0" UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03

Check the hostname, IP address and interface down and up ifconfig ifconfig eth0 up ifconfig eht0 down iwconfig ip a arp dhclient renew new IP from DHCP server or or ifup eth0

ifdown eth0

wireless interface display IP address

hostname, domainname, dnsdomainname, nisdomainname, ypdomainname -a aliase -d domain name -f fully qualified domain name (fqdn) -i IP address -y NIS domain name ethtool eth0 ethtool i eth0 ethtool p eth0mii-tool eth0 ip link show eth0 ip addr ping [Link] host [Link] or test connectivity host [Link] or nslookup [Link] information display driver settings Blink LAN LED

nslookup [Link] dig [Link]

Assign IP addrss and restart the service system-config-network

system-config-network-tui system-config-network-cmd service network status | start | restart service NetworkManager status | start | restart chkconfig network --list | on | off chkconfig NetworkManager --list | on | off Check the port number and routing command route traceroute netstat -r -i -t -u -a -p -e -l -n display the routing rable display interface statistics shows tcp connection shows udp connection display all sockets (tcp,udp or local) display process IDs display extended information listening numerical

Network monitoring command nmap tcpdump Examples [root@server1 Desktop]# ifconfig eth0 Link encap:Ethernet HWaddr [Link] inet addr:[Link] Bcast:[Link] Mask:[Link] inet6 addr: fe80::20c:29ff:fed5:d21f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:96 errors:0 dropped:0 overruns:0 frame:0 TX packets:426 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7584 (7.4 KiB) TX bytes:28359 (27.6 KiB) lo Link encap:Local Loopback inet addr:[Link] Mask:[Link] inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:531 errors:0 dropped:0 overruns:0 frame:0 TX packets:531 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:45677 (44.6 KiB) TX bytes:45677 (44.6 KiB)

[root@server1 Desktop]# ip a 1: lo: mtu 16436 qdisc noqueue state UNKNOWN

link/loopback [Link] brd [Link] inet [Link]/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether [Link] brd [Link] inet [Link]/24 brd [Link] scope global eth0 inet6 fe80::20c:29ff:fed5:d21f/64 scope link valid_lft forever preferred_lft forever 3: pan0: mtu 1500 qdisc noop state DOWN link/ether [Link] brd [Link]

[root@server1 Desktop]# ip addr 1: lo: mtu 16436 qdisc noqueue state UNKNOWN link/loopback [Link] brd [Link] inet [Link]/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether [Link] brd [Link] inet [Link]/24 brd [Link] scope global eth0 inet6 fe80::20c:29ff:fed5:d21f/64 scope link valid_lft forever preferred_lft forever 3: pan0: mtu 1500 qdisc noop state DOWN link/ether [Link] brd [Link] [root@server1 Desktop]# hostname [Link] [root@server1 Desktop]# hostname -d [Link] [root@server1 Desktop]# hostname -s server1 [root@server1 Desktop]# hostname -a server1 [root@server1 Desktop]# hostname -f [Link] [root@server1 Desktop]# hostname -i [Link] [root@server1 Desktop]# hostname -y (none) [root@server1 Desktop]# iwconfig lo no wireless extensions. eth0 pan0 no wireless extensions. no wireless extensions.

[root@server1 Desktop]# ethtool eth0

Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: d Wake-on: d Current message level: 0x00000007 (7) Link detected: yes

[root@server1 Desktop]# ethtool -i eth0 driver: e1000 version: 7.3.21-k6-1-NAPI firmware-version: N/A bus-info: [Link].0 ethtool s eth0 speed 100 autoneg off ethtool S eth0 [root@server1 Desktop]# mii-tool eth0 eth0: negotiated 100baseTx-FD, link ok [root@server1 Desktop]# host [Link] [Link].[Link] domain name pointer [Link]. [root@server1 Desktop]# host [Link] [Link] has address [Link] [root@server1 Desktop]# nslookup [Link] Server: [Link] Address: [Link]#53 Name: [Link] Address: [Link] [root@server1 Desktop]# nslookup [Link] Server: [Link] Address: [Link]#53 [Link].[Link] name = [Link].

[root@server1 Desktop]# dig [Link]


; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> [Link] ;; global options: +cmd

;; Got answer: ;; ->>HEADER<<- 11399="" id:="" noerror="" opcode:="" query="" span="" status:=""> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;[Link]. ;; ANSWER SECTION: [Link]. 86400 ;; AUTHORITY SECTION: [Link].

IN

IN

[Link]

86400

IN

NS

[Link].

;; Query time: 0 msec ;; SERVER: [Link]#53([Link]) ;; WHEN: Sun Dec 2 [Link] 2012 ;; MSG SIZE rcvd: 67

[root@server1 Desktop]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface [Link] * [Link] U 1 0 0 eth0 default [Link] [Link] UG 0 0 0 eth0 [root@server1 Desktop]# netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface [Link] * [Link] U 00 0 eth0 default [Link] [Link] UG 00 0 eth0

[root@server1 Desktop]# netstat -tulnp | grep 22 tcp 0 0 [Link]:22 [Link]:* LISTEN 2184/sshd tcp 0 0 :::22 :::* LISTEN 2184/sshd [root@server1 Desktop]# nmap -sTU -p 21 [Link] Starting Nmap 5.21 ( [Link] ) at 2012-12-02 22:05 IST Nmap scan report for [Link] ([Link]) Host is up (0.00020s latency). PORT STATE SERVICE 21/tcp open ftp 21/udp closed ftp Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds [root@server1 Desktop]# nmap -sTU -p 22 [Link] Starting Nmap 5.21 ( [Link] ) at 2012-12-02 22:05 IST Nmap scan report for [Link] ([Link]) Host is up (0.00042s latency). PORT STATE SERVICE 22/tcp open ssh 22/udp closed ssh

Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds

You might also like