Basic Network connectivity with LINUX + useful commands

Verify interfaces and their status

ifconfig   [Physical LAN]

iwconfig  [Wireless LAN]

Previous versions (before BT5R3) had networking disabled by default.  

To start it use:

/etc/init.d/networking start

or could use the command “start networking”

Enable SSH

sshd-generate

/etc/init.d/ssh start

could also have said “start ssh”

Assign static IP, and bring interface up

ifconfig eth0 192.168.1.222/24 up

ifconfig eth0

Configure default gw

route add default gw 192.168.1.1

ping 8.8.8.8

See the contents of the resolv.conf file

more /etc/resolv.conf

Add dns info to resolv file

echo nameserver 8.8.8.8 > /etc/resolv.conf

Ensure network config is permanent

vi /etc/network/interfaces

! use ins key to change edit mode

! edit the interface that is being used on your BT

iface eth0 inet static

address 192.168.1.222

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

gateway 192.168.1.1

! use esc : w q  (to save and exit)

Another way of making the IP persistent accross reboots

update-rc.d networking defaults

enable ssh at boot time

update-rc.d -f ssh defaults

Enable/Disable/Restart  networking service, if ever you need to

/etc/init.d/networking start

/etc/init.d/networking restart

/etc/init.d/networking stop

Options for up and down

ifconfig eth0 up

ifconfig eth0 down

to become dhcp client

dhclient eth0

useful commands

folder size; run from root / or any other directory you’re in to see largest folders

du -smh * | sort +0nr

also to see;

disk usage partitions and amount of spaced, used, available and total size use

dh -h (this is human readable i.e show it like 500Mb etc)

dh -k also

 

Package management commands in debian;

 

sudo apt-get update (updates to latest apt-get)
sudo apt-get install rpm (downloads and installs rpm)
sudo apt-get install alien (downloads and installs alien so you can convert .rpm files for red hat to .dpkg for debian)
sudo alien nmap-5.51-1.i386.rpm (this runs alien on the .rpm file convert it to .deb , debian format)
dpkg -i nmap-5.51-1.i386.deb (dpkg – debian package manager rpm = red hat package manager)

About

fwknowledge.wordpress.com

Tagged with: , , , , , , , , ,
Posted in Useful Tools

Leave a comment