Eng | Rus

Virtual terminal and comand line interface.

NET-Simulator allows the users to control the virtual devices by means of virtual terminals and command line interface. 'Double click' on the device icon to open the terminal window. Use up/down keys to navigate the commands history.

Type help and press Enter to see a list of all available commands. Use -h option with any of the commands to get a reference guide. Use Ctrl+L to refresh the screen.

Command reference:

help
route
ifconfig
ping
arp
mactable

help - display reference guide and exit.

help [-h]

OptionDescription
-hDisplay reference guide and exit.



route manipulates the IP4 routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured using the ifconfig program.

route [-h] [{-add|-del} <target> [-netmask <address>] [-gw <address>] [-metric <M>] [-dev <If>]]

OptionDescription
-hDisplay reference guide and exit.
target Destination address. It can be a network or a host depending on the netmask option. If netmask is not specified of equals to 255.255.255.255 then the destination is a host, otherwise it is a network.
-add Add a new route.
-delDelete a route.
-dev <If> Force the route to be associated with the specified device. In most normal networks you won't need this. If - the interface name.
-gw <address> Route packets via a gateway. The specified gateway must be reachable first. This usually means that you have to set up a static route to the gateway beforehand. address - the gateway address.
-netmask <address> When adding a network route, the netmask to be used. address - the netmask value. If the netmask is not specified 255.255.255.255 is used.
-metric <M> Set the metric field in the routing table to M. M - an integer greater or equal to to 0.

When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables:

     =>route
     IP routing table
     Destination       Gateway       Netmask          Flags   Metric  Iface
     10.0.0.0          *             255.0.0.0        U       1       eth0
     11.0.0.0          10.0.0.10     255.0.0.0        UG      1       eth0
     192.168.120.1     10.0.0.10     255.255.255.255  UGH     1       eth0
 

If the gateway is not set * is pitnted. Flags possible values include: U - route is up, G - use gateway, H - target is a host.

Examples:

     =>route -add 192.168.120.0 -netmask 255.255.255.0 -dev eth0
     =>route
     IP routing table
     Destination       Gateway          Netmask          Flags   Metric  Iface
     192.168.120.0     *                255.255.255.0    U       1       eth0
     =>
     =>route -add 192.168.121.10 -gw 192.168.120.10 
     =>route
     IP routing table
     Destination       Gateway          Netmask          Flags   Metric  Iface
     192.168.120.0     *                255.255.255.0    U       1       eth0
     192.168.121.10    192.168.120.1    255.255.255.255  UGH     1       eth0
     =>
     
 


ifconfig - configure a network interface.

ifconfig [-h] [-a] [<interface>] [<address>] [-broadcast <address>] [-netmask <address>] [-up|-down]

OptionDescription
-hDisplay reference guide and exit.
-a Display all interfaces which are currently available, even if they are down.
interface The name of the interface. Use this option to configure the interface or see the information about it.
addressThe IP address to be assigned to this interface.
-broadcast <address> If the address argument is given, set the protocol broadcast address for this interface.
-netmask <address> Set the IP network mask for this interface. This value defaults to the usual class A, B or C network mask (as derived from the interface IP address), but it can be set to any value.
-up This flag causes the interface to be activated. It is implicitly specified if an address is assigned to the interface. The appropriate row is added to the routing table implicitly.
-down This flag deactivates the interface. The appropriate row is deleted from the routing table implicitly.

Without options ifconfig displays all active interfaces:

    =>ifconfig
    eth0    Link encap:Ethernet  HWaddr 0:0:0:0:CF:0
            inet addr:192.168.120.1  Bcast:192.168.120.255  Mask:255.255.255.0
            UP
            RX packets:23 errors:0 dropped:0
            TX packets:23 errors:0 dropped:0
            RX bytes:0 TX bytes:0
 

HWaddr - 6 bytes unique address of the interface by analogy to MAC address in Ethernet. It is generated automatically.

Examples:

    =>ifconfig eth0 192.168.120.1 -up
    =>ifconfig
    eth0    Link encap:Ethernet  HWaddr 0:0:0:0:CF:0
            inet addr:192.168.120.1  Bcast:192.168.120.255  Mask:255.255.255.0
            UP
            RX packets:0 errors:0 dropped:0
            TX packets:0 errors:0 dropped:0
            RX bytes:0 TX bytes:0    
 


ping  uses ICMP protocol in order to check the accessibility of the target interface. ping sends ICMP ECHO_REQUEST to the target interface and waits during some period of time (one second by default) for ICMP ECHO_RESPONSE. In case if the response is received displays gathered data.

ping [-h] [-i <interval>] [-t <ttl>] <destination>

OptionDescription
-hDisplay reference guide and exit.
-i <interval> Wait interval seconds between sending each packet. The default is to wait for one second between each packet.
-t <ttl> Set the IP Time to Live attribute value. ttl is an integer 0-255 (64 by default).
destination IP-address of the target interface.

Examples:

    =>ping 192.168.120.1
    PING 192.168.120.1
    64 bytes from 192.168.120.1: icmp_seq=0 ttl=62 time=477 ms
    64 bytes from 192.168.120.1: icmp_seq=1 ttl=62 time=435 ms
    64 bytes from 192.168.120.1: icmp_seq=2 ttl=62 time=234 ms
    64 bytes from 192.168.120.1: icmp_seq=3 ttl=62 time=48 ms
    64 bytes from 192.168.120.1: icmp_seq=4 ttl=62 time=87 ms
    64 bytes from 192.168.120.1: icmp_seq=5 ttl=62 time=56 ms
 

ping displays the output in the following format: 64 bytes from 192.168.120.1 - the size of data received in the response and the address of the target host. The size is always 64B. icmp_seq=0 - the number of the packet in the sequence. ttl=62 - TTL value from the received packet. time=48 ms - round-trip time in milliseconds.

The Ctrl-C key combination aborts command execution.



arp - displays the ARP-table. In addition there is NET-Simulator specific option -r that allows sending the special request in order to resolve the MAC-address for the specified IP-address. This option does not make sense in the real world but in the simulator can be useful for the ARP-protocol understanding.

arp [-h] [-r <IP-address> <interface>]

OptionDescription
-hDisplay reference guide and exit.
-r <IP-address> <interface> Forces NET-Simulator to resolve MAC-address for the specified IP-address. IP-address target IP-address. interface the name of a device to send the request.

Without options displays ARP-table:

     =>arp
     Address          HWaddress       iface
     10.0.0.10        0:0:0:0:BC:0    eth0
     10.0.0.11        0:0:0:0:1F:2    eth0
 

Examples:

      =>arp -r 192.168.120.12 eth1
     Address          HWaddress       iface
     10.0.0.10        0:0:0:0:BC:0    eth0
     10.0.0.11        0:0:0:0:1F:2    eth0
     192.168.120.12   0:0:0:0:12:1    eth1
 


mactable - displays the MAC-address table. This is NET-Simulator specific option.

mactable [-h]

OptionDescription
-hDisplay reference guide and exit.

Examples:

     =>mactable
     MACAddress      port
     0:0:0:0:B3:0    0
     0:0:0:0:2F:2    0
     0:0:0:0:03:0    3
 

port - the number of the port.




Last update: 18.08.2013 22:08. Email: maxim-tereshin@yandex.ru