The gMan nixWiki

Because the mind is made of Teflon...

User Tools

Site Tools


general_cli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
general_cli [2020/04/20 22:35] gmangeneral_cli [2020/09/11 18:00] (current) – [check deb] gman
Line 1: Line 1:
-====== Network Commands ======+====== CLI ======
  
-[[general_configs#Networking|Configs]] are found here. 
  
-===== see IP info =====+===== check deb =====
  
-Pick one, they basically do the same thing +** Change"check distro" -- put in how to check kali in /etc/??? **
-<code> +
- ifconfig -a        # Debian net-tools pkg +
- ls /sys/class/net  # ls interface names +
- ip a +
- ip a show +
- ip a show eth0 +
-</code>+
  
-===== manual up/down =====+Check which Debian install you have:  
 +<code>lsb_release -a</code>
  
-Manually bringing your network up and down ([[https://www.cyberciti.biz/faq/linux-restart-network-interface/|nixCraft]] has a good explanation):  +===== echo vsprintf =====
-  * Assuming eth0 (change for whichever interface you want to manipulate).+
  
-**Generic Method:** 
 <code> <code>
-ifdown eth0   Turn off eth0 +echo $var             is the same as... 
-ifup eth0     # Turn on eth0 +printf '%s\n' "$var"
-</code>+
  
-Use a specific configuration file: +echo -n $var          is the same as... 
- +printf '%s' "$var"
-<code> +
-ifdown wlan0  bring interface down +
-ifup --interfaces /path/to/file/interface_config_file wlan0+
 </code> </code>
  
-**Debian Method** (as root): +----
-<code> +
-/etc/init.d/networking restart  # Restarts network interfaces, or stop/start...  +
-/etc/init.d/networking stop     # Stops network interfaces +
-/etc/init.d/networking start    # Starts network interfaces+
  
-systemctl restart networking    # For those with lovely systemd +===== find =====
-systemctl status network        # See status of network systemd +
-</code>+
  
-===== ifupdown vs. ifconfig =====+Basic Syntax: 
  
-**Debian, overview:** +<code>find /path/to/search/ -name searchTerm</code>
-  * ''ifup'' and ''ifdown'' control interfaces that are listed in ''/etc/network/interfaces''+
-  * ''ifconfig'' directly controls network interfaces (much like the newer ''ip'' command)+
  
-**The** ''ifupdown'' **package:** high-level network configuration +If you get a bunch of garbage on the screensend it all to /dev/null:
-  * The ''ifup'' and ''ifdown'' commands may be used to configure or deconfigure network interfaces based on interface definitions in the file ''/etc/network/interfaces''+
-  * Example: bring up the network with ''ifup eth0'' based on eth0 configuration in ''/etc/network/interfaces''+
-  * ''ifupdown'' will wrap ''ifconfig'' with the network configuration files (i.e.''ifdown'' or ''ifup'' will execute ''ifconfig down'' or ''ifconfig up'' inside it). That means:  +
-    * ''ifup eth0'' will fetch the interface config file and bring up the interface with the correct IP address, mask, routes etc.  +
-    * ''ifconfig eth0'' up would just start the interface **//with no IP//**, etc. (important for sniffing in monitor mode because you don't want an IP address, etc.; you want an open broadcase).+
  
-**The** ''ifconfig'' **command:** a low-level network command (and deprecated, sadly) +<code>find /path/to/search/ -name searchTerm 2>/dev/null</code>
-  * An ''ifconfig up eth0'' activates eth0 but does not setup IP addresses, etc. +
-  * An ''ifup eth0'' sets up IP addresses and other options based on the interface's configuration in ''/etc/network/interfaces''.+
  
-===== ip command =====+----
  
-**Usage of the** ''ip'' **command:** +===== tar =====
-  * If your distro did not install ifconfig, you can install it in Debian with ''apt install net-tools''+
-  * Or you can use the horridly ugly syntax for ''ip'' (complex and hard-to-understand help can be found [[https://www.howtogeek.com/657911/how-to-use-the-ip-command-on-linux/|here]] or an easier-to-understand explanation [[https://www.tecmint.com/ip-command-examples/|here]]). +
-  * From the following example you will need to replace the IP and the interface with your own.+
  
-**[1] Assign an IP address to a specific interface:** 
-<code>ip addr add 192.168.0.100/24 dev eth0</code> 
- 
-**[2] Bring up the interface link** (do NOT skip this step or you will get a "Network is unreachable" error!): 
-<code>ip link set eth0 up</code> 
- 
-**[3] Bring up the interface link:** 
-<code>ip route add default via 192.168.0.1</code> 
- 
-**[1-3] All in one place... looks like this:** 
 <code> <code>
-ip addr add 192.168.0.100/24 dev eth0 +tar xvzf filename
-ip link set eth0 up +
-ip route add default via 192.168.0.1 +
-</code>+
  
-**Note on Persistence:** This will only set up your network for your current work session. You'll lose it on reboot. +# x - extract 
-  * ''ip'' (like the old net-tools ''ifconfig'' stuff) interacts with ''/etc/network/interfaces'', so put all your network configuration information there and just up/down your network with these commands:  +# v verbose 
- +z - zip gnuzip 
-<code> +f - file (name follows)
-/etc/init.d/networking restart  Restarts network interfaces, or stop/start...  +
-/etc/init.d/networking stop     Stops network interfaces +
-/etc/init.d/networking start    # Starts network interfaces+
 </code> </code>
  
 ---- ----
 +
  
general_cli.1587422144.txt.gz · Last modified: by gman