some basic Linux Network CommandsBASIC SETUP: ifconfig lan0 192.168.11.42 netmask 255.255.255.0 broadcast 192.168.11.255 ADD ROUTE: route add default gw 192.168.11.1 ========================================================================= 1) ifconfig -a, ip addr 2) ping -c 3 8.8.8.8 3) route 4) netstat -ar 5) traceroute 8.8.8.8 6) nslookup ========================================================================= 1) ifconfig -a, ip addr --> ifconfig --help Usage: ifconfig [-a] [-i] [-v] [-s] <interface> [[<AF>] <address>] [add <address>[/<prefixlen>]] [del <address>[/<prefixlen>]] [[-]broadcast [<address>]] [[-]pointopoint [<address>]] [netmask <address>] [dstaddr <address>] [tunnel <address>] [outfill <NN>] [keepalive <NN>] [hw <HW> <address>] [metric <NN>] [mtu <NN>] [[-]trailers] [[-]arp] [[-]allmulti] [multicast] [[-]promisc] [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>] [txqueuelen <NN>] [[-]dynamic] [up|down] ... <HW>=Hardware Type. List of possible hardware types: loop (Local Loopback) slip (Serial Line IP) cslip (VJ Serial Line IP) slip6 (6-bit Serial Line IP) cslip6 (VJ 6-bit Serial Line IP) adaptive (Adaptive Serial Line IP) ether (Ethernet) tr (16/4 Mbps Token Ring) tr (16/4 Mbps Token Ring (New)) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) tunnel (IPIP Tunnel) ppp (Point-to-Point Protocol) arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device) sit (IPv6-in-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI) irda (IrLAP) x25 (generic X.25) infiniband (InfiniBand) <AF>=Address family. Default: inet List of possible address families: unix (UNIX Domain) inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25) ------------------------------------------------ --> ip --help Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } ip [ -force ] -batch filename where OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | fou | tcp_metrics | token | netconf } OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] | -h[uman-readable] | -iec | -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } | -4 | -6 | -I | -D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -br[ief] | -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] | -rc[vbuf] [size] | -n[etns] name | -a[ll] |Â -c[olor]} --> ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 64:00:6x:7x:0x:x3 brd ff:ff:ff:ff:ff:ff inet 1xx.xx3.1x2.5x/22 brd 1xx.xx3.1x5.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::6600:6xxf:fx7x:65x/64 scope link valid_lft forever preferred_lft forever ========================================================================= 2) ping -c 3 8.8.8.8 --> ping --help ping: invalid option -- '-' Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline] [-W timeout] [hop1 ...] destination ========================================================================= 3) route --> route --help Usage: route [-nNvee] [-FC] [<AF>] List kernel routing tables route [-v] [-FC] {add|del|flush} ... Modify routing table for AF. route {-h|--help} [<AF>] Detailed usage syntax for specified AF. route {-V|--version} Display version/author and exit. -v, --verbose be verbose -n, --numeric don't resolve names -e, --extend display other/more information -F, --fib display Forwarding Information Base (default) -C, --cache display routing cache instead of FIB <AF>=Use '-A <af>' or '--<af>'; default: inet List of possible address families (which support routing): inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25) ========================================================================= 4) netstat -ar --> netstat --help usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help} netstat [-vnNcaeol] [<Socket> ...] netstat { [-veenNac] -i | [-cnNe] -M | -s } -r, --route display routing table -i, --interfaces display interface table -g, --groups display multicast group memberships -s, --statistics display networking statistics (like SNMP) -M, --masquerade display masqueraded connections -v, --verbose be verbose -n, --numeric don't resolve names --numeric-hosts don't resolve host names --numeric-ports don't resolve port names --numeric-users don't resolve user names -N, --symbolic resolve hardware names -e, --extend display other/more information -p, --programs display PID/Program name for sockets -c, --continuous continuous listing -l, --listening display listening server sockets -a, --all, --listening display all sockets (default: connected) -o, --timers display timers -F, --fib display Forwarding Information Base (default) -C, --cache display routing cache instead of FIB -T, --notrim dont't trim address information <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom --sctp <AF>=Use '-A <af>' or '--<af>'; default: inet List of possible address families (which support routing): inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25) --> sudo netstat -p | grep gvfs Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name unix 3 [ ] STREAM CONNECTED 114793 15281/gvfs-udisks2- unix 3 [ ] STREAM CONNECTED 24494 2218/gvfsd unix 3 [ ] STREAM CONNECTED 115939 15326/gvfs-mtp-volu unix 3 [ ] STREAM CONNECTED 1858297 20230/gvfsd-metadat unix 3 [ ] STREAM CONNECTED 115940 15326/gvfs-mtp-volu unix 3 [ ] STREAM CONNECTED 114800 15293/gvfs-goa-volu unix 3 [ ] STREAM CONNECTED 113953 15281/gvfs-udisks2- unix 3 [ ] STREAM CONNECTED 90983 15326/gvfs-mtp-volu unix 3 [ ] STREAM CONNECTED 112147 15281/gvfs-udisks2- unix 3 [ ] STREAM CONNECTED 114823 15331/gvfs-gphoto2- unix 3 [ ] STREAM CONNECTED 113952 15281/gvfs-udisks2- unix 3 [ ] STREAM CONNECTED 27727 2218/gvfsd unix 3 [ ] STREAM CONNECTED 114816 15317/gvfs-afc-volu unix 3 [ ] STREAM CONNECTED 114815 15317/gvfs-afc-volu unix 3 [ ] STREAM CONNECTED 113958 15293/gvfs-goa-volu unix 3 [ ] STREAM CONNECTED 26878 2223/gvfsd-fuse unix 3 [ ] STREAM CONNECTED 92608 15317/gvfs-afc-volu unix 3 [ ] STREAM CONNECTED 1858296 20230/gvfsd-metadat unix 3 [ ] STREAM CONNECTED 114801 15293/gvfs-goa-volu unix 3 [ ] STREAM CONNECTED 1865893 20230/gvfsd-metadat unix 3 [ ] STREAM CONNECTED 112188 15331/gvfs-gphoto2- unix 3 [ ] STREAM CONNECTED 112187 15331/gvfs-gphoto2- unix 3 [ ] STREAM CONNECTED 27728 2218/gvfsd ========================================================================= 5) traceroute 8.8.8.8 --> traceroute --help Usage: traceroute [ -46dFITnreAUDV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w waittime ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] [ --fwmark=num ] host [ packetlen ] Options: -4 Use IPv4 -6 Use IPv6 -d --debug Enable socket level debugging -F --dont-fragment Do not fragment packets -f first_ttl --first=first_ttl Start from the first_ttl hop (instead from 1) -g gate,... --gateway=gate,... Route packets through the specified gateway (maximum 8 for IPv4 and 127 for IPv6) -I --icmp Use ICMP ECHO for tracerouting -T --tcp Use TCP SYN for tracerouting (default port is 80) -i device --interface=device Specify a network interface to operate with -m max_ttl --max-hops=max_ttl Set the max number of hops (max TTL to be reached). Default is 30 -N squeries --sim-queries=squeries Set the number of probes to be tried simultaneously (default is 16) -n Do not resolve IP addresses to their domain names -p port --port=port Set the destination port to use. It is either initial udp port value for "default" method (incremented by each probe, default is 33434), or initial seq for "icmp" (incremented as well, default from 1), or some constant destination port for other methods (with default of 80 for "tcp", 53 for "udp", etc.) -t tos --tos=tos Set the TOS (IPv4 type of service) or TC (IPv6 traffic class) value for outgoing packets -l flow_label --flowlabel=flow_label Use specified flow_label for IPv6 packets -w waittime --wait=waittime Set the number of seconds to wait for response to a probe (default is 5.0). Non-integer (float point) values allowed too -q nqueries --queries=nqueries Set the number of probes per each hop. Default is 3 -r Bypass the normal routing and send directly to a host on an attached network -s src_addr --source=src_addr Use source src_addr for outgoing packets -z sendwait --sendwait=sendwait Minimal time interval between probes (default 0). If the value is more than 10, then it specifies a number in milliseconds, else it is a number of seconds (float point values allowed too) -e --extensions Show ICMP extensions (if present), including MPLS -A --as-path-lookups Perform AS path lookups in routing registries and print results directly after the corresponding addresses -M name --module=name Use specified module (either builtin or external) for traceroute operations. Most methods have their shortcuts (`-I' means `-M icmp' etc.) -O OPTS,... --options=OPTS,... Use module-specific option OPTS for the traceroute module. Several OPTS allowed, separated by comma. If OPTS is "help", print info about available options --sport=num Use source port num for outgoing packets. Implies `-N 1' --fwmark=num Set firewall mark for outgoing packets -U --udp Use UDP to particular port for tracerouting (instead of increasing the port per each probe), default port is 53 -UL Use UDPLITE for tracerouting (default dest port is 53) -D --dccp Use DCCP Request for tracerouting (default port is 33434) -P prot --protocol=prot Use raw packet of protocol prot for tracerouting --mtu Discover MTU along the path being traced. Implies `-F -N 1' --back Guess the number of hops in the backward path and print if it differs -V --version Print version info and exit --help Read this help and exit Arguments: + host The host to traceroute to packetlen The full packet length (default is the length of an IP header plus 40). Can be ignored or increased to a minimal allowed value ========================================================================= 6) nslookup --> man nslookup | col -b NSLOOKUP(1) BIND9 NSLOOKUP(1) NAME nslookup - query Internet name servers interactively SYNOPSIS nslookup [-option] [name | -] [server] DESCRIPTION Nslookup is a program to query Internet domain name servers. Nslookup has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain. ARGUMENTS Interactive mode is entered in the following cases: 1. when no arguments are given (the default name server will be used) 2. when the first argument is a hyphen (-) and the second argument is the host name or Internet address of a name server. Non-interactive mode is used when the name or Internet address of the host to be looked up is given as the first argument. The optional second argument specifies the host name or address of a name server. Options can also be specified on the command line if they precede the arguments and are prefixed with a hyphen. For example, to change the default query type to host information, and the initial timeout to 10 seconds, type: nslookup -query=hinfo -timeout=10 The -version option causes nslookup to print the version number and immediately exits. ========================================================================= 1) ifconfig -a, ip addr 2) ping -c 3 8.8.8.8 3) route 4) netstat -ar 5) traceroute 8.8.8.8 6) nslookup |
|
Wagoneers FULL SIZE JEEPS JeepMeister "Jeep is America's -Enzo Ferrari MeisterTech Diesels + |
One Page Overview of Linux Commands click for an image of the 5 essential Linux commands An Intro to Linux |
at Midway Auto on SR9 in Snohomish, or at Northland Diesel in Bellingham, WA |