,

Your IP Address

what is my ip address?

Basic Networking Commands in Unix

I would like to discuss the basic Unix commands useful for networking:
Network interfaces commands:
  • ifconfig –a —- Show all interfaces
  • ifconfig <interface name> ——shows the configuration (like IP, MAC, SubNet, IPV6) of a particular interface
  • ifconfig <interface name> <params> —–Set parameters of the interface (Root only) You can set various parameters like  IP address, subnet,
  • ifconfig <interface name> <params> <up/down>—– that particular interface is Up (activated) or down (deactivated)
Connectivity:
  • ping <host> —- sends an ICMP echo message (one packet) to a host. This may go continually until you hit Control-C.  Ping means a packet was sent from your machine via ICMP, and echoed at the IP level. ping tells you if the other Host is Up.
  • telnet host <port> —- talk to “hosts” at the given port number. By default, the telnet port is port 23. Few other famous ports are:  7 – echo port, use control-] to get out
    25 – SMTP, use to send mail
    79 – Finger, provides information on other users of the network
Arp:
  • arp –a —- Print the arp table. Arp is used to translate IP addresses into Ethernet addresses. Root can add and delete arp entries. Deleting them can be useful if an arp entry is malformed or just wrong. Arp entries explicitly added by root are permanent — they can also be by proxy. The arp table is stored in the kernel and manipulated dynamically. Arp entries are cached and will time out and are deleted normally in 20 minutes
Routing:
  • netstat –r —- Print routing tables. The routing tables are stored in the kernel and used by ip to route packets to non-local networks.
  • route add <IP/SubNet> <GateWay> —- The route command is used for setting a static (non-dynamic by hand route) route path in the route tables. All the traffic from this PC to that IP/SubNet will  go through the given Gateway IP. It can also be used for setting a default route; i.e.,  send all packets to a particular gateway, by using 0.0.0.0 in the pace of IP/SubNet.
  • routed —– The BSD daemon that does dynamic routing. Started at boot. This runs the RIP routing protocol. ROOT ONLY. You won’t be able to run this without root access.
  • gated —– Gated is an alternative routing daemon to RIP. It uses the OSPF, EGP, and RIP protocols in one place. ROOT ONLY.
  • traceroute <host> —- Useful for tracing route of IP packets. The packet causes message to be sent back from all gateways in between the source and destination by increasing the number of hopes by 1 each time.
Others:
  • nslookup <host> —-  Makes queries to the DNS server to translate IP to a name, or vice versa. eg. nslookup facebook.com will gives you the IP of facebook.com
  • ftp <host> —– Transfer files to host. Often can use login=“anonymous” , p/w=“guest”
  • rlogin <host> -l <login> —– Logs into the host with a virtual terminal like telnet
Important Files:
  • /etc/hosts —- names to ip addresses
  • /etc/networks —- network names to ip addresses
  • /etc/protocols —– protocol names to protocol numbers
  • /etc/services —- tcp/udp service names to port numbers
Courtsey: Prof. Andrej Duda, Wikipedia, math.uaa.alaska.edu

0 comments:

Post a Comment