Lets ping
Script to ping the network:
#/bin/bash
for i in 10.112.1.1..255}
do
ping $i > /dev/null
[$? -eq 0] && echo $i is up
trap "exit" SIGINT
done
Run the script.
Configure Network:
ifconfig = for static IP.
dhclient == for dynamic IP using DHCP.
#ifconfig -a
This shows the interface devices available.
Output as:
+ eth0 is ethernet card.
+ lo is loopback device.
+ wlan0 is wireless LAN card.
Assign Static IP:
#ifconfig eth0 10.112.1.15
The see the information on eth0:
#ifconfig eth0
Setting the subnet mask:
#ifconfig eth0 10.112.1.15 netmask 255.255.255.0
Now get your ethernet up (or down)
#ifup eth0
#ifdown eth0
Wireless Networking
Use following commands:
#iwconfig
#iwconfig wlan0 essid <name of wireless network>
#iwconfig wlan0 essid <name of wireless network> key <KEY>
Scan and check availability of wireless networks:
#iwlist
#iwlist wlan0 scan
#ifconfig wlan0 <IP>
#dhclient wlan0
The IP settings assigned above for LAN or WLAN, is not persistent after system reboot. For that:
#vi /etc/networks/interfaces
Add below lineto configure eth0 as DHCP:
auto eth0
iface eth0 inet dhcp
For static:
auto eth0
iface eth0 inet static
address <IP>
netmask <netmask>
gateway <gw ip>
If its a wireless network, add below also:
wireless-essid <network-name>
wireless-key <key>
Now, restart network daemon:
#/etc/init.d/network restart
Spoofing a MAC ID:
#ifconfig eth0 hw ether <new hw address>
Use this command to change the MAC address of your network card.
DNS:
It provides name resolution. Look at below file for name server's IP.
#cat /etc/resolv.conf
nameserver <IP>
Search more at www.opendns.org
SSH
Make remote logins to other machines.
[MachineA]#ssh test@<IP>
[MachineB]$
sftp is extension of SSH to transfer files.
#sftp test@<IP>
sftp>get abc
To download files, use get command. To upload files, use put command.
sshfs is another extension of SSH to mount directories ona remote machine.
#sshfs test@<IP>:/home/test /mnt/test
No comments:
Post a Comment