Menu

Commands_of_v14

Raizo62

Network

fast-ip

  • Configuration of IP address and eventually the gateway.
  • fast-ip, fast-dhcp and fast-dns used together enable to setup a dynamic DNS.
  • When it sets an interface to vlan, the mother of the interface (if it was down) is set to "manual" mode
  • To use it, you must be root or in the group "sudo"

Synopsis

  • fast-ip [INTERFACE-NAME][INTERFACE-NUMBER][:SUB-INTERFACE][.VLAN-NUMBER] IP-ADDRESS/NET-MASK [IP-GATEWAY]
  • fast-ip [INTERFACE-NAME][INTERFACE-NUMBER][:SUB-INTERFACE][.VLAN-NUMBER] dhcp
  • fast-ip [INTERFACE-NAME][INTERFACE-NUMBER][:SUB-INTERFACE][.VLAN-NUMBER] manual

Examples

  • fast-ip 172.16.40.17/24
    • enp1s0 : 172.16.40.17/24
  • fast-ip 1 172.16.40.17/24
    • enp1s1 : 172.16.40.17/24
  • fast-ip 2 172.16.40.17/24 172.16.40.254
    • enp1s2 : 172.16.40.17/24 and gateway : 172.16.40.254
  • fast-ip 3 dhcp
    • enp1s3 requests an IP to a DHCP server
  • fast-ip 0.10 172.16.40.17/24 172.16.40.254
    • vlan 10 on enp1s0 : 172.16.40.17/24 and gateway : 172.16.40.254
  • fast-ip virbr0 172.16.40.17/24 172.16.40.254
    • virbr0 : 172.16.40.17/24 and gateway : 172.16.40.254
  • fast-ip enp1s0.10 172.16.40.17/24 172.16.40.254
    • vlan 10 on enp1s0 : 172.16.40.17/24 and gateway : 172.16.40.254
    • if enp1s0 was down, enp1s0 is set to manual mode
  • fast-ip 0:1 172.16.40.17/24 172.16.40.254
    • sub interface 1 of enp1s0 : 172.16.40.17/24 and gateway : 172.16.40.254

fast-dhcp

  • Configuration of a DHCP server based on the IP address of the server.
  • fast-dhcp configures the dnsmasq server
  • fast-ip, fast-dhcp and fast-dns used together enable to setup a dynamic DNS.
  • You can change the default domain (domain.lan.) used by fast-dhcp and fast-dns by
    • modifying the variable FAST_DOMAIN in /opt/raizo/etc/fast.conf
    • exporting the variable FAST_DOMAIN :
export  FAST_DOMAIN="yournewdomain.org"
  • To use fast-dhcp, you must be root or in the group "sudo"

Synopsis

  • fast-dhcp [INTERFACE-NAME]INTERFACE-NUMBER[:SUB-INTERFACE][.VLAN-NUMBER] [IP-DNS]

By default :

  • IP-DNS is IP address of nameserver found in /etc/resolv.conf. If it doesn't find it, it uses the IP address of INTERFACE-NUMBER
  • The default gateway of dhcp clients is the default gateway of the network of chosen interface, or IP address of INTERFACE-NUMBER

Example

  • fast-dhcp 2 172.16.4.3
    • if IP address of enp1s2 is 192.168.33.17
      • create pool of IP addresses : 192.168.33.[10,100]/24
      • gateway of dhcp clients can be 192.168.33.17
      • DNS of dhcp clients will be 172.16.4.3
  • fast-dhcp enp1s2
    • if IP address of enp1s2 is 192.168.33.17
      • create pool of IP addresses : 192.168.33.[10,100]/24
      • gateway of dhcp clients can be 192.168.33.254
      • DNS of dhcp clients will be 192.168.33.17

fast-dns

  • Configuration of a DNS server.
  • fast-dns configures the dnsmasq server
  • if name is not ended by a dot, fast-dns adds to name the default domain (domain.lan.)
  • fast-ip, fast-dhcp and fast-dns used together enable to setup a dynamic DNS.
  • You can change the default domain (domain.lan.) used by fast-dhcp and fast-dns by
    • modifying the variable FAST_DOMAIN in /opt/raizo/etc/fast.conf
    • exporting the variable FAST_DOMAIN :
export  FAST_DOMAIN="yournewdomain.org"
  • To use fast-dns, you must be root or in the group "sudo"

Synopsis

  • fast-dns NAME IP [NAME2 IP2 [NAME3 IP3 [NAME4 IP4...]]]
    • Creates a DNS server (if necessary), and adds the record for theirs IPs and theirs NAMEs
  • fast-dns dns
    • Clears the previous records of the DNS server and creates a new one.

Examples

  • fast-dns PC1 10.0.0.1
    • For the server DNS, PC1.domain.lan. has the IP 10.0.0.1
  • fast-dns PC2.other.local. 10.0.0.2
    • For the server DNS, PC1.domain.lan. has the IP 10.0.0.1 and PC2.other.local. has the IP 10.0.0.2
  • fast-dns PC3 10.0.0.3 PC4.other.local. 10.0.0.4
    • For the server DNS, PC1.domain.lan. has the IP 10.0.0.1, PC2.other.local. has the IP 10.0.0.2, PC3.domain.lan. has the IP 10.0.0.3 and PC4.other.local. has the IP 10.0.0.4
  • fast-dns PC2.other.local. 10.0.0.4
    • For the server DNS, PC1.domain.lan. has the IP 10.0.0.1, PC2.other.local. has the IP 10.0.0.4, PC3.domain.lan. has the IP 10.0.0.3 and PC4.other.local. has the IP 10.0.0.4
  • fast-dns dns
    • Reset records of the DNS server

fast-rip

  • RIPv2 router configuration for IPv4 and IPv6
  • fast-rip configures the FRRouting server
  • To use it, you must be root or in the group "sudo"

fast-proxy-on

  • Configure shell variables, sudo config and Docker to use the proxy
  • Use configuration of /etc/resolv.conf to exclude networks from proxy
  • By default, use the proxy "proxy:8080"
  • if user is not root or in sudo group, fast-proxy-on does only the commands that doesn't need to have root power

Synopsis

  • fast-proxy-on [IP:PORT]
    • [IP:PORT] : use IP:PORT as proxy

fast-proxy-off

  • Remove configuration of fast-proxy-on
  • if user is not root or in sudo group, fast-proxy-off does only the commands that doesn't need to have root power

fast-http

  • Start a web server on the port 80 and share a directory (by default : "/home/user")
  • CTRL+C to stop it

Synopsis

  • fast-http [SharedFolder]
    • [SharedFolder] : the folder to share. By default : "/home/user"

fast-vwifi

On LiveRaizo

  • Enable the virtual wifi 802.11
  • Use and configure the program vwifi
  • The command must be start on LiveRaizo
  • You can change MAC address prefixes by modifying the variable VWIFI_PREFIX_MAC_ADDRESS
export  VWIFI_PREFIX_MAC_ADDRESS="94:95:96"

Synopsis

  • fast-vwifi [NUMBER_WIFI_INTERFACE]
    • [NUMBER_WIFI_INTERFACE] : Number of wifi interfaces wlan must be created

On Debian VM

  • Enable the virtual wifi 802.11
  • Use and configure the program vwifi
  • The command must be start on each VM Debian
  • You can change MAC address prefixes by modifying the variable VWIFI_PREFIX_MAC_ADDRESS
  • with the optional parameter "-s", you set the IP of vwifi-server, and use the TCP protocol.
export  VWIFI_PREFIX_MAC_ADDRESS="94:95:96"

Synopsis

  • fast-vwifi [NUMBER_WIFI_INTERFACE] -s [IP_SERVER]
    • [NUMBER_WIFI_INTERFACE] : Number of wifi interfaces wlan must be created ( <= 10)
    • -s [NUMBER_WIFI_INTERFACE] : Set the IP address of server and use the TCP protocol.

fast-wifi-docker

  • Add a wlan interfaces to Docker VM
  • The command must be start on LiveRaizo
  • You can change MAC address prefixes by modifying the variable VWIFI_PREFIX_MAC_ADDRESS
export  VWIFI_PREFIX_MAC_ADDRESS="94:95:96"
  • fast-wifi-docker can't be use in the same time as fast-vwifi

Synopsis

  • fast-wifi-docker [-y] [-a] [-r] [-m] [-n Number] [-c NumberWlanToCreate] [NameOfVM1] [NameOfVM2] [NameOfVM3] [NameOfVM...]
    • -y|Y|o|O : don't ask for confirmation from user to add wlan
    • -a|A : select all the VMs
    • -r|R : set a random MAC address to wlan interfaces
    • -m|M : enable the monitor mode for wlan0 of LiveRaizo
    • -n|N Number : number of wlan interfaces by VM
    • -c|C NumberWlanToCreate : number of wlan interfaces to create, if it is not enough

Examples

  • fast-wifi-docker
    • Display the VM Devices availables and ask the number of the VM. fast-wifi-docker ask for confirmation before to add a wlan interface to the Virtual Machines selected.
  • fast-wifi-docker -Y
    • Display the VM Devices availables and ask the number of the VM. fast-wifi-docker do not ask for confirmation to add a wlan interface to the Virtual Machines selected.
  • fast-wifi-docker AP1
    • Ask for confirmation before to add a wlan interface to the Virtual Machine "AP1".
  • fast-wifi-docker -Y Client1
    • Add a wlan interface to the Virtual Machine "Client1".
  • fast-wifi-docker -Y PC1 PC2 Server5
    • Add a wlan interface to the Virtual Machines "PC1", "PC2" and "Server5"


System

fast-rescan-interfaces

  • Scan to detect new plugged network interfaces, and update the files /etc/network/interfaces, history of Zsh/Bash

fast-syslog

  • Displays in color the last 40 lines of the file /var/log/syslog

fast-mount-usb

  • Mount the USB key in the directory /media/usb0. If /mnt/usb0 is already used, fast-mount-usb will use /mnt/usb1, etc

Synopsis

  • fast-mount-usb [-q]
    • -q|Q : quiet mode : show only the mounted point and the label
    • -h|H|? : show this help

fast-battery

  • Display the percentage of energy remaining in the battery.
    • Try to bring the console windows to the front if percentage of energy remaining is less of 10%, and if the battery is detected and not charging

Synopsis

  • fast-battery [-i] [-t] [-p] [-u]
    • -i|I : checks this percentage every 60 seconds and displays the changes
    • -t|T : show this percentage in the title bar of xterm
    • -p|P : do a pause before to stop the program
    • -u|U : test of utility. exit 0 only if usefull : battery detected
    • -h|H|? : show this help


Laboratory

fast-save-project

  • Asks questions to save a GNS3 project

Synopsis

Steps

  1. Show detected projects of GNS3 in /home/user/projects and ask which you want to save. For each project, it shows his current size.
  2. Launch fast-mount-usb to detect new usb keys connected
  3. Show destinations where to copy the backup of project
    • For each usb key, it shows the free space on the total space.
  4. Do the backup with fast-backup-lab
  5. Run associated command with destination
  6. If destination is usb, ask to umount the usb key

Your own commands

  • You can add your own destination and associated commands in /opt/raizo/etc/cmd-fast-save-project.conf
  • Line is commented if it begins with #
  • Each line must be : title [command options]

    • title : title shown by fast-save-project in the step where you must choose the destination
    • command options : if it is not empty, the command "command options" is launched after the backup
    • In command options, use "%f" for name of archive
  • You can use more functionality if title begins with "local:", "net:" or "usb:",

    • local:directory : Before to run fast-backup-lab, it verifies that directory exists
    • net:title : Before to run fast-backup-lab, it verifies that it has an IPv4 address
    • usb:mountPoint :
      • Before to run fast-backup-lab, it verifies that mountPoint is already mounted
      • After the backup in mountPoint, fast-save-project asks if it musts unmount mountPoint
  • Example of /opt/raizo/etc/cmd-fast-save-project.conf

# Copy into /mnt/archive and ask to unmount /mnt/archive
usb:/mnt/archive
# Copy into /tmp and show details on archive
local:/tmp  ls -l %f
# Copy on the FTPs server : srvftp.domain.local
net:ftps echo -n "Login : " && read LOGIN && lftp -u $LOGIN -e "set ftp:ssl-protect-data true ; put '%f'; exit" srvftp.domain.local

fast-backup-lab

  • Backup of the GNS3 project with configuration of GNS3, Qemu,....

Synopsis

  • fast-backup-lab [-g] [-p] [-s] [-w] [-d] [-c] [-f] [-l] [-n] [-a] [-t] [-y] [DIRECTORY-PROJECT-GNS3] [DIRECTORY-DESTINATION]
    • Creates an archive of the directory "DIRECTORY-PROJECT-GNS3". This archive is created in the directory "DIRECTORY-DESTINATION"
    • -g|G : exclude the configurations files of GNS3 from archive
    • -p|P : exclude the GNS3 project from archive
    • -s|S : exclude the Startups files from archive
    • w|W : exclude the backup of the vwifi's state
    • -d|D : ADD the Default config of devices
    • -c|C : ADD the Capture files from archive
    • -f|F : ADD the Firewall rules
    • -l|L : ADD the sysctl config
    • -n|N : ADD the network configuration
    • -a|A : ADD the same as : -f -l -n
    • -t|T : test only the config. Don't create the archive
    • -y|Y|o|O : Don't ask for confirmation from user
    • -h|H|? : show this help

Examples

  • fast-backup-lab TP
    • Create an archive TP_backup_20130723_12_20_10.tar.xz
  • fast-backup-lab TP /media/usb0
    • Create an archive /media/usb0/TP_backup_20130723_12_23_05.tar.xz
  • fast-backup-lab -P
    + Create an archive config_backup_20130723_12_29_43.tar.xz with only the configurations files

fast-restore-lab

  • Restore a GNS3 project, which has been saved with fast-backup-lab or fast-save-project
  • By default, the GNS3 project is restored in the directory /home/user/projects
  • fast-restore-lab refuses to restore a saved config of GNS3 if it is incompatible with the installed GNS3

Synopsis

  • fast-restore-lab [-g] [-p] [-s] [-w] [-d] [-c] [-f] [-l] [-n] [-v] BACKUP-PROJECT-GNS3
    • -g|G : don't extract the configurations files of GNS3 from archive
    • -p|P : don't extract the GNS3 project from archive
    • -s|S : don't extract the Startups files from archive
    • w|W : exclude the startup of vwifi
    • -d|D : exclude the Default config of devices
    • -c|C : exclude the Captured packets
    • -f|F : exclude the Firewall rules of Live from archive
    • -l|L : exclude the sysctl config of Live from archive
    • -n|N : don't extract the network files of Live from archive
    • -u|U : use the current directory to receive the GNS3 project
    • -v|V : only verify if the current version of VMRaizo is compatible
    • -h|H|? : show this help

Example

  • fast-restore-lab TP_backup_20130723_12_20_10.tar.xz
    • Restores files from the archive TP_backup_20130723_12_20_10.tar.xz
  • fast-restore-lab -s TP_backup_20130723_12_20_10.tar.xz
    • Restores files from the archive TP_backup_20130723_12_20_10.tar.xz, without restoring Startups files

fast-reset-vm

  • Reset the QEmu devices :
    • The Hard Disks of the QEmu device return to their initials states
  • fast-reset-vm must be used when a project of GNS3 is open
  • It loads the credential of GNS3 from /opt/raizo/etc/gns3.conf

Synopsis

  • fast-reset-vm [-a] [-y|-o] [NAME-VM1] [NAME-VM2] [NAME-VM3] [NAME-VM...]

    • -a|-A : Select all the VMs
    • -y|-Y|-o|-O : Don't ask for confirmation from user
    • NAME-VM : reset only the VM "NAME-VM1", "NAME-VM2", "NAME-VM3"...
    • -h|H|? : show this help
  • fast-reset-vm is case insensitive on the name "NAME-VM" if there are no doubt on the choose.

Examples

  • fast-reset-vm
    • Display the VM Devices availables and ask the number of the VM. fast-reset-vm ask for confirmation before to reset the Virtual Machines selected.
  • fast-reset-vm -Y
    • Display the VM Devices availables and ask the number of the VM. fast-reset-vm do not ask for confirmation to reset the Virtual Machines selected.
  • fast-reset-vm Router1
    • Ask for confirmation before to reset the Virtual Machine "Router1".
  • fast-reset-vm -Y Server1
    • Reset the Virtual Machine "Server1".
  • fast-reset-vm -Y PC1 PC2 Server5
    • Reset the Virtual Machines "PC1", "PC2" and "Server5"

fast-clean-crash-gns3

  • Kill all the processes used by GNS3 (in case of a crash for instance).

Synopsis

  • fast-clean-crash-gns3 [-y|-o] [-h]
    • -y|-Y|-o|-O : Don't ask for confirmation from user
    • -h|H|? : show this help

Examples

  • fast-clean-crash-gns3
    • Ask for confirmation before to kill all the processes used by GNS3.
  • fast-clean-crash-gns3 -Y
    • Kill all the processes used by GNS3.

fast-nat

  • enable IP forwarding, configure an DHCP Server and an DNS Server and use NAT with packets coming out of the virbr0 interface

Synopsis

  • fast-nat [-d] [-n] [-i] [-s] [IP-ADDRESS]
    • -d : disable the DHCP service
    • -n : disable the DNS service
    • -i : don't run iptables rules
    • -s : don't start the sysctl config
    • if virbr0 has an IP, and IP-ADDRESS is not defined, then fast-nat uses the IP of virbr0
    • if virbr0 has no IP, and IP-ADDRESS is not defined, then fast-nat uses the IP 10.145.147.1
    • if IP-ADDRESS is defined, then fast-nat uses this IP and modifies with it the IP of virbr0

Example

> fast-nat
* fast-ip virbr0 10.145.147.1/24
        + [/etc/network/interfaces : Add the new configuration for virbr0]
        * sudo ifup virbr0
* fast-dns dns
        + [/etc/Raizo.dnsmasq.hosts : Create the file]
        + [/etc/dnsmasq.d/Raizo.DNS.conf : Configuration of the server]
        * sudo systemctl start dnsmasq
        * sudo systemctl enable dnsmasq
Synchronizing state of dnsmasq.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable dnsmasq
* fast-dhcp virbr0 10.145.147.1
        # Pool          : 10.145.147.[10,100]/24
        # Gateway       : 10.145.147.1
        # DNS           : 10.145.147.1
        -----------------------------
        * sudo systemctl stop dnsmasq
        + [/etc/dnsmasq.d/Raizo.DHCP.conf : Add pool 10.145.147.[10,100]/24]
        * sudo systemctl start dnsmasq
* sudo sysctl net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
* sudo iptables -t mangle -I PREROUTING -i virbr0 -j MARK --set-mark 0xd001
* sudo iptables -t nat -I POSTROUTING -m mark --mark 0xd001 -j MASQUERADE

fast-vwifi-update-gns3

  • Update the server "vwifi" with the geographical coordinates of each VM from GNS3

  • vwifi-server (fast-vwifi) must be started before

  • fast-vwifi-update-gns3 must be used when a project of GNS3 is open
  • fast-vwifi-update-gns3 update only the coordinate of the VMs which use the VHOST protocol
  • It loads the credential of GNS3 from /opt/raizo/etc/gns3.conf

fast-gns3-server

  • Start the gns3server.
  • Without parameter, gnsserver is started in foreground. CTRL+C to stop it.
  • It loads the credential of GNS3 from /opt/raizo/etc/gns3.conf
  • If gns3server is already started by gns3-gui, then gns3server becomes accessible from external IPs.

Synopsis

  • fast-gns3-server [-r] [-s] [-d]
    • r|R : run the service gns3-server (sudo systemctl start gns3-server.service)
    • s|S : stop the service gns3-server (sudo systemctl stop gns3-server.service)
    • -d|D : display if gns3server is running

Add-to-GNS3.sh



Update

fast-startup

  • Mount automatically the USB key in /media/usb0 (or usb1, usb2..) and processes the script /media/usb0/raizo.sh.

Synopsis

  • fast-startup [NAME-SCRIPT]

    • By default, NAME-SCRIPT is raizo.sh. NAME-SCRIPT will always be lowercase before downloading.
    • You can modify default values in the file /opt/raizo/etc/fast-startup.conf
    • Your script raizo.sh (or NAME-SCRIPT) can affect a value different of zero at the variable FAST_ERROR_RAIZO to indicate an error at fast-startup. You can use the variable FAST_ERROR_RAIZO_LOG to indicate also a message
    • You can use the variable MOUNT_KEY to know where the usb key is mounted

Examples

  • fast-startup
    • Mount automatically the USB key in /media/usb0 and processes the script /media/usb0/raizo.sh.
  • fast-startup US
    • Mount automatically the USB key in /media/usb0 and processes the script /media/usb0/us.

fast-update

  • Download the file on a web server and processes it.

Synopsis

  • fast-update [-s WEB-SERVER] [NAME-SCRIPT]

    • By default, NAME-SCRIPT is raizo.sh. NAME-SCRIPT will always be lowercase before downloading.
    • By default, WEB-SERVER is UpdateRaizo.
    • You can modify the default values in the file /opt/raizo/etc/fast-startup.conf
    • Your script raizo.sh (or NAME-SCRIPT) can affect a value different of zero at the variable FAST_ERROR_RAIZO to indicate an error at fast-update. You can use the variable FAST_ERROR_RAIZO_LOG to indicate also a message.

Examples



Helps

fast-memo

  • Display a reminder

Synopsis

  • fast-memo [-t] [NAME-MEMO]
    • -t|T : Show the name of memo in the title bare of xterm
    • -h|H|? : show this help
    • NAME-MEMO : Show the reminder "NAME-MEMO". If none NAME-MEMO is indicated then fast-memo shows all reminders available. You must indicate the number of memo that you want display

Keys to interact

  • "q" to quit (as less command)
  • "/" to search a word. It ignores case, except if any uppercase letters appear in the search pattern
    • "n" to find the next word
    • "shift+n" the find the previous word

Examples

> fast-memo
Available choices :
 1) *QUIT*    24) diff    47) mkdir    70) sockstat
 2) 7z        25) dig     48) mount    71) sort
 3) ab        26) distcc      49) mysql    72) split
 4) apparmor  27) emacs   50) mysqldump    73) ssh
 5) apt-cache 28) find    51) ndiswrapper  74) ssh-copy-id
 6) apt-get   29) gcc     52) netcat       75) ssh-keygen
 7) aptitude  30) gdb     53) netstat      76) stdout
 8) asterisk  31) git     54) nmap     77) strace
 9) at        32) GNS3    55) notify-send  78) systemctl
10) awk       33) gpg     56) od       79) tail
11) bash      34) grep    57) openssl      80) Tap
12) Bridge    35) gs          58) pdftk    81) tar
13) chmod     36) head    59) php      82) tcpdump
14) chown     37) history     60) ping     83) tmux
15) Cisco     38) ifconfig    61) ps       84) top
16) convert   39) ip          62) python       85) truncate
17) crontab   40) iptables    63) rm       86) uname
18) curl      41) iwconfig    64) Routage      87) vim
19) cut       42) less    65) sam2p    88) Vlan
20) date      43) ln          66) scp      89) wget
21) dd        44) ls          67) screen       90) WiFi
22) df        45) lsof    68) sed
23) dhclient  46) MAC     69) shred
#?
> fast-memo pi
(From cheat / https://github.com/chrisallenlane/cheat)

# ping a host with a total count of 15 packets overall.
ping -c 15 www.example.com

# ping a host with a total count of 15 packets overall, one every .5 seconds (faster ping).
ping -c 15 -i .5 www.example.com

# test if a packet size of 1500 bytes is supported (to check the MTU for example)
ping -s 1500 -c 10 -M do www.example.com