,

Your IP Address

what is my ip address?

Useful basic commands for Networking


ifconfig <interface> <address> [up]
ifconfig <interface> [down|delete]
ethereal to launch ethereal
tcpdump –i <interface> tool to capture and analyze packets
netstat –w [seconds] –I [interface] display network settings and statistics
udpmt –p [port] –s [bytes] target_host it creates UDP traffic
udptarget –p [port] it’s able to receive UDP traffic
tcpmt –p [port] –s [bytes] target_host it creates TCP traffic
tcptarget –p [port] it’s able to receive TCP traffic
ARP, switching and VLANs
arp –a it shows the current ARP table
arp –s <ip_address> <mac_address> to add an entry in the table
arp –a –d to delete all the entries in the ARP table
telnet 192.168.0.254 to access the switch from a host in its subnetwork
sh ru or show running-configuration to see the current configurations
configure terminal to enter in configuration mode
exit in order to go to the lower configuration mode
vlan n it creates a VLAN with ID n
no vlan N it deletes the VLAN with ID N
untagged Y it adds the port Y to the VLAN N
ifconfig vlan0 create it creates vlan0 interface
ifconfig vlan0 vlan ID vlandev em0 it associates vlan0 interface on top of em0, and set the tags to ID
ifconfig vlan0 <address> [up] to turn on the virtual interface
tagged Y it adds to the port Y the support of tagged frames for the current VLAN
Routing
netstat –rnf inet it displays the routing tables of IPv4
sysctl net.inet.ip.forwarding=1 to enable packets forwarding (to turn a host into a router)
route add|delete [-net|-host] <destination> <gateway> (ex. route add 192.168.20.0/24 192.168.30.4) to add a route
route flush it removes all the routes
route add -net 0.0.0.0 192.168.10.2 to add a default route
routed -Pripv2 –Pno_rdisc –d [-s|-q] to execute routed daemon with RIPv2 protocol, without ICMP auto-discovery, in foreground, in supply or in quiet mode
route add 224.0.0.0/4 127.0.0.1 it defines the route used from RIPv2
rtquery –n to query the RIP daemon on a specific host (manually update the routing table)
UDP/TCP
socklab udp it executes socklab with udp protocol
sock it creates a udp socket, it’s equivalent to type sock udp and bind
sendto <Socket ID> <hostname> <port #> emission of data packets
recvfrom <Socket ID> <byte #> it receives data from socket
socklab tcp it executes socklab with tcp protocol
passive it create a socket in passive mode, it’s equivalent to sock tcp, bind, listen
accept it accepts an incoming connection (it can be done before or after creating the incoming connection)
active it create a socket in active mode
connect <hostname> <port #> these two commands are equivalent to sock tcp, bind, connect
close it closes the connection
read <byte #> to read bytes on the socket
write (ex. write ciao, ex. write #10) to write “ciao” or to write 10 bytes on the socket
NAT/Firewall
ipnat –f file_name it writes filtering rules into file_name
ipnat –l it gives the list of active rules
ipnat –C –F it re-initialize the rules table
map em0 192.168.1.0/24 -> 195.221.227.57/32 portmap tcp/udp 20000:50000
ipf –f file_name it writes filtering rules into file_name
ipf –F –a it resets the rule table
ipmon log_file in proto icmp all it allows to display the specified traffic
ipfstat –I it grants access to a few information on filtered packets, as well as active filtering rules
[block/pass] [in/out] proto [icmp/tcp/udp] from [any/192.168.0.1/24] port=22 to [any/192.168.1.1/24] port=80
If You want a pdf version: basic unix networking commands
Courtesy: Jianning Zhang

0 comments:

Post a Comment