Basic networking from the command line: ifconfig, eth0, wifi0, routes

Posted in Linux

See current network properties for all interfaces

/sbin/ifconfig

Manually configure an IP address for interface eth0

/sbin/ifconfig eth0 192.168.1.2/24

Change eth0’s hardware MAC address (976-EVIL)

/sbin/ifconfig eth0 hw ether 00:99:77:66:33:88:44:55

Put eth0 in/out of promiscuous mode

(must do this as root or else SIOCSIFFLAGS: Permission denied)

sudo /sbin/ifconfig eth0 promisc
sudo /sbin/ifconfig eth0 -promisc

See the current network properties for all wireless interfaces

/sbin/iwconfig

Configure wireless to talk to a specific access point by name

/sbin/iwconfig wifi0 essid bobs_tacos

Configure wireless to talk to a specific access point by address

(may be different from its network MAC address)

/sbin/iwconfig wifi0 ap 00:60:1D:01:23:45

Configure WEP encryption on a wireless interface

/sbin/iwconfig wifi0 key s:password
/sbin/iwconfig wifi0 key [2]
/sbin/iwconfig wifi0 commit

Configure a wireless interface to use channel 11

/sbin/iwconfig wifi0 channel 11

Put a wireless interface in computer-to-computer Ad-Hoc mode

/sbin/iwconfig wifi0 mode Ad-Hoc

Set the default gateway

sudo /sbin/route add default gw 192.168.1.1

Send a broadcast request for a DHCP address

sudo /sbin/dhclient

Ask on just one interface

sudo /sbin/dhclient eth0

Configure static routes

sudo /sbin/route add -net 10.1.1.1 netmask 255.0.0.0 dev eth0
sudo /sbin/route add -host 72.14.247.104 eth0

Network stats on eth0

netstat -Ieth0

See what PIDs/processes are associated with remote connections

netstat -nutap
tcp  0   0  10.2.3.4:39270    10.0.0.1:80       TIME_WAIT   -
tcp  0   0  10.2.3.4:37401    10.0.0.2:22       ESTABLISHED 943/ssh
tcp  0   0  10.2.3.4:52627    10.0.0.1:80       TIME_WAIT   -
tcp  0   0  10.2.3.4:39271    10.0.0.1:80       ESTABLISHED 895/firefox-bin
tcp  0   0  10.2.3.4:33968    10.0.0.3:3389    ESTABLISHED 998/rdesktop
Posted by admica   @   17 March 2009

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« Finding things in Active Directory using the command line
Next Post
AdFind - Command line Active Directory query tool for regular users »
Powered by Wordpress   |   Lunated designed by ZenVerse