Net prog1-net-7
-
Upload
maria-sawaby-nazehat -
Category
Technology
-
view
111 -
download
0
Transcript of Net prog1-net-7
Technical Foundation of Computer Science 5Network Programming I
Maria Sawaby
Department of Communication and Operating System
May 26, 2015
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 1 / 12
Contents
1 Basic networking primer
2 Name server and DNS (Domain Name Service)DNS lookupSetting default gateway, showing routing table information
3 Summary
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 2 / 12
Basic networking primer
shell scripts can be used to con�gure nodes in a network, test theavailability of machines, automate execution of commands at remotehost and so on
ifcon�g is used to display details about network interfaces, subnetmask and so on
The ifcon�g command displays details of every network interfaceavailable on the system
we can restrict it to a speci�c interface by using
$ifcon�g iface_name
$ifcon�g wlan0
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 3 / 12
ifcon�g
In order to set the IP address for a network interface
$sudo ifcon�g iface-name IP-address
$sudo ifcon�g wlan0 192.168.1.10
$sudo ifcon�g wlan0 192.168.1.10 netmask 255.255.255.0
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 4 / 12
Spoo�ng Hardware Address (MAC Address)
In certain circumstances where authentication or �ltering of computerson a network is provided by using the hardware address, we can usehardware address spoo�ng
# ifcon�g eth0 hw ether 00:1c:bf:87:25:d5
this command will assign "00:1c:bf:87:25:d5" as the new MAC address
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 5 / 12
Name server and DNS (Domain Name Service)
DNS servers con�gured with our network resolve the domain nameinto the corresponding IP address
Name servers assigned to the current system can be viewed by reading/etc/resolv.conf
$cat /etc/resolv.conf
We can add name servers manually
$sudo echo nameserver IP_ADDRESS � /etc/resolv.conf
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 6 / 12
DNS lookup
host and nslookup are two DNS lookup utilities which will request aDNS server for an IP address resolution
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 7 / 12
DNS lookup
Without using the DNS server, it is possible to add a symbolic nameto IP address resolution just by adding entries into �le /etc/hosts
In order to add an entry
# echo IP_ADDRESS symbolic_name � /etc/hosts
# echo 192.168.0.9 backupserver.com � /etc/hosts
After adding this entry, whenever a resolution to backupserver.comoccurs, it will resolve to 192.168.0.9
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 8 / 12
Setting default gateway, showing routing table informationroute
The operating system maintains a table called the routing table, whichcontains information on how packets are to be forwarded and through
which machine node in the network $ route
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 9 / 12
Setting default gateway, showing routing table informationroute
A default gateway is set as follows:
# route add default gw IP_ADDRESS INTERFACE_NAME
For example:# route add default gw 192.168.0.1 wlan0
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 10 / 12
Summary
ifcon�g, used to display details about network interfaces
host and nslookup are used to resolve a name to an IP address byasking a DNS server
route, to set default gateway and showing routing table information
Lecture-7 (Network-Department) Net-Prog I May 26, 2015 11 / 12