Monday, July 1, 2013

Some commands related to networking on Linux

Network Device Up and Down
$ service network restart
$ /etc/init.d/network restart

$ service network start
$ service network stop

$ifdown eth0
$ifup eth0

$ ifconfig

$ dhclient

Name Server
$ vim /ect/resolv.conf
[root@sr1s1 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 129.174.97.3
nameserver 129.174.68.227
nameserver 129.174.1.3

HostName
$ echo hostname=$HOSTNAME >> /etc/sysconfig/network
set hostname

Routing Table
$ route
show the routing tables

IP Table
$ iptables --list
view all of the ip table rules

Opening Ports
$lsof -i

Start SSH
$ service sshd restart

Automatically Start SSH on Boot
$ chkconfig --level 5 --del sshd
$ chkconfig --level 5 --add sshd

Query system running service
$ chkconfig

Update bashrc or profile
$ source ~/.profile

No comments: