Tuesday, December 9, 2008

Linux IP Command Lines

Display Current Config for all NIC's: ifconfig

syntax:- ifconfig dev ip netmask broadcast

Display Current Config for eth0: ifconfig eth0

Assign IP: ifconfig eth0 192.168.1.2

Assign IP/Subnet: ifconfig eth0 192.168.1.2 netmask 255.255.255.0

Assign Default Gateway: route add default gw 192.168.1.1

Assign multiple IP's: ifconfig eth0:0 192.168.1.2

Assign second IP: ifconfig eth0:1 192.168.1.3

Disable network card: ifconfig eth0 down

Enable network card: ifconfig eth0 up



View current routing table: route "or" route -n

View arp cache: arp "or" arp -n

Ping: ping -c 3 192.168.1.1

Trace Route: traceroute www.whatismyip.com

Trace Path: tracepath www.whatismyip.com

DNS Test: host www.whatismyip.com

Advanced DNS Test: dig www.whatismyip.com

Reverse Lookup: host 66.11.119.69

Advanced Reverse Lookup: dig -x 66.11.119.69

NB:- Warning untested



Setting Up NICs under Fedora and RHEL

Fedora and other Red Hat–type systems use a simple setup that makes it easy to configure network cards at boot time. It is done through the creation of files in the /etc/sysconfig/network-scripts directory that are read at boot time. All of the graphical tools
under Fedora create and manage these files for you; for other people who like to get under the hood, the following sections show how to manually manage the configuration files.

For each network interface, there is an ifcfg file in /etc/sysconfig/network-scripts.
This filename is suffixed by the name of the device; thus, ifcfg-eth0 is for the eth0 device,ifcfg-eth1 is for the eth1 device, and so on.

If you choose to use a static IP address at installation time, the format for the interface configuration file for eth0 will be as follows:

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR= 192.168.1.100
GATEWAY=192.168.1.1
TYPE=Ethernet
HWADDR=00:0c:29:ac:5b:cd

TIP In Fedora, Red Hat Enterprise Linux (RHEL), and Centos distros, the file /usr/share/doc/initscripts-*/sysconfig.txt explains the options and variables that can be used in the “/etc/sysconfig/network-scripts/ifcfg-*”, among other things.

From linux news

No comments:

Post a Comment