general_network
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
general_network [2020/05/03 18:33] – [Examples] gman | general_network [2022/09/24 02:00] (current) – removed gman | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Network Commands ====== | ||
- | |||
- | ===== see IP info ===== | ||
- | |||
- | Pick one, they basically do the same thing: | ||
- | < | ||
- | | ||
- | ls / | ||
- | ip a | ||
- | ip a show | ||
- | ip a show eth0 | ||
- | </ | ||
- | |||
- | ===== manual up/down ===== | ||
- | |||
- | Manually bringing your network up and down ([[https:// | ||
- | * Assuming eth0 (change for whichever interface you want to manipulate). | ||
- | |||
- | **Generic Method:** | ||
- | < | ||
- | ifdown eth0 # Turn off eth0 | ||
- | ifup eth0 # Turn on eth0 | ||
- | </ | ||
- | |||
- | Use a specific configuration file: | ||
- | |||
- | < | ||
- | ifdown wlan0 # bring interface down | ||
- | ifup --interfaces / | ||
- | </ | ||
- | |||
- | **Debian Method** (as root): | ||
- | < | ||
- | / | ||
- | / | ||
- | / | ||
- | |||
- | systemctl restart networking | ||
- | systemctl status network | ||
- | </ | ||
- | |||
- | ===== ifupdown vs. ifconfig ===== | ||
- | |||
- | **Debian, overview:** | ||
- | * '' | ||
- | * '' | ||
- | |||
- | **The** '' | ||
- | * The '' | ||
- | * Example: bring up the network with '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | **The** '' | ||
- | * An '' | ||
- | * An '' | ||
- | |||
- | ===== ip command ===== | ||
- | |||
- | **Usage of the** '' | ||
- | * If your distro did not install ifconfig, you can install it in Debian with '' | ||
- | * Or you can use the horridly ugly syntax for '' | ||
- | * 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: | ||
- | < | ||
- | |||
- | **[2] Bring up the interface link** (do NOT skip this step or you will get a " | ||
- | < | ||
- | |||
- | **[3] Bring up the interface link:** | ||
- | < | ||
- | |||
- | **[1-3] All in one place... looks like this:** | ||
- | < | ||
- | ip addr add 192.168.0.100/ | ||
- | ip link set eth0 up | ||
- | ip route add default via 192.168.0.1 | ||
- | </ | ||
- | |||
- | **Note on Persistence: | ||
- | * '' | ||
- | |||
- | < | ||
- | / | ||
- | / | ||
- | / | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Network Management ====== | ||
- | |||
- | Source: https:// | ||
- | |||
- | ===== Three Options ===== | ||
- | |||
- | There are 3 services that might be managing your network (in order to avoid configuration conflicts related to networks, only one networking service should be enabled at one time)... | ||
- | - ifupdown | ||
- | - systemd-networkd | ||
- | - Network Manager | ||
- | |||
- | ---- | ||
- | |||
- | ===== [1] ifupdown ===== | ||
- | |||
- | If you are used to managing your networks using the “interfaces” file, you might want to keep doing that, otherwise it is recommended to switch to the Network Manager. | ||
- | |||
- | If you cannot do an '' | ||
- | |||
- | This is the traditional (old school, deprecated) way to manager network interfaces. it is done through a configuration files located: | ||
- | |||
- | < | ||
- | |||
- | If your distro installed Network Manager and you want to use ifupdown, do the following... | ||
- | - Include '' | ||
- | - You can also change '' | ||
- | - Manually configure your interfaces in ''/ | ||
- | * **//This should be all you need to do//** (i.e., you probably don't even need to worry about steps 1 & 2). | ||
- | * The moment you configure an interface in ''/ | ||
- | - Restart your networking service: '' | ||
- | |||
- | ---- | ||
- | ===== [2] Network Manager ===== | ||
- | |||
- | On newer systems, the Network Manager (Debian package: network-manager) is used instead of ifupdown (and its / | ||
- | |||
- | You can find the network configs in a //keyfile// (.ini format): | ||
- | < | ||
- | # / | ||
- | |||
- | [main] | ||
- | plugins=ifupdown, | ||
- | |||
- | [ifupdown] | ||
- | managed=false | ||
- | # true = ifupdown does manage networks | ||
- | |||
- | </ | ||
- | |||
- | **Multiple plugins:** specify in a preference order using ',' | ||
- | * Example: '' | ||
- | * When creating new connections, | ||
- | * If the first plugin cannot write out that connection type, or can't write out any connections, | ||
- | * The //keyfile// plugin is the generic plugin that supports all the connection types and capabilities that NM has. It writes files out in a .ini-style format in / | ||
- | |||
- | **Configuration File:** The Network Manager configuration file can be found here (but you should use nmcli or, preferred, nmtui to configure a connection) | ||
- | |||
- | < | ||
- | |||
- | **Network Manager Tools** (included with install): | ||
- | * __nmcli__: the dedicated command line tool used in order to configure, add, edit and remove connections using the Network Manager; | ||
- | * __nmtui__: (tab-complete to see shortcuts) a graphical user interface that provides just a subset of features compated to nmcli. Using nmtui, you can edit a connection, activate a connection or change the hostname of your computer; | ||
- | * __nm-applet__: | ||
- | |||
- | ---- | ||
- | |||
- | ===== [3] systemd-networkd ===== | ||
- | |||
- | Loaded but inactive on a standard Debian install. | ||
- | |||
- | Reference: https:// | ||
- | |||
- | ---- | ||
- | |||
- | ====== Configs ====== | ||
- | |||
- | ===== Explanation ===== | ||
- | |||
- | You can set up as many network configs for as many interfaces as you want. Just set them up, comment them out, and when you want to use one remove the # and bring it up. | ||
- | * As root, edit: ''/ | ||
- | * Note: Keep the loopback and everything else your *nix install put in there... you have been warned. | ||
- | * The following example assumes eth0 for wired network and wlan0 for wireless. | ||
- | |||
- | **Alternative: | ||
- | * Put a DHCP for home in one file and static in another. | ||
- | * Put multiple hackLab configs for WEP, WPA, etc. each in its own file and bring them up/down with ifupdown using '' | ||
- | |||
- | ===== Examples ===== | ||
- | | ||
- | < | ||
- | # +-------------------------+ # | ||
- | # | Wired Network Interface | # | ||
- | # +-------------------------+ # | ||
- | |||
- | # Comment out these lines if you want to manually bring up your network | ||
- | allow-hotplug eth0 # bring up the interface on a hotplug event like plugging in a usb cable | ||
- | auto eth0 # bring up the interface on boot | ||
- | |||
- | ## The following w/o auto or allow-hotplug requires manual up. | ||
- | |||
- | ## [1] STATIC (replace subnet with your own): | ||
- | #iface eth0 inet static | ||
- | # address | ||
- | # netmask | ||
- | # network | ||
- | # gateway | ||
- | # broadcast 192.168.0.255 | ||
- | |||
- | ## [2] DHCP (one or the other): | ||
- | #iface eth0 inet dhcp # IPv4 | ||
- | #iface eth0 inet6 auto # IPv6 | ||
- | |||
- | # +----------------------------+ # | ||
- | # | Wireless Network Interface | # | ||
- | # +----------------------------+ # | ||
- | |||
- | # Comment out these lines if you want to manually bring up your network | ||
- | allow-hotplug wlan0 | ||
- | auto wlan0 | ||
- | |||
- | ## The following w/o auto or allow-hotplug requires manual up. | ||
- | |||
- | ## [1] STATIC (replace subnet with your own; either WEP or WPA/WPA2): | ||
- | |||
- | # WEP static | ||
- | #iface wlan0 inet static | ||
- | # address | ||
- | # netmask | ||
- | # network | ||
- | # gateway | ||
- | # broadcast | ||
- | # wireless-essid SSID_of_Router | ||
- | # wireless-key | ||
- | |||
- | ## WPA/WPA2 static | ||
- | #iface wlan0 inet static | ||
- | # address | ||
- | # netmask | ||
- | # network | ||
- | # gateway | ||
- | # broadcast 10.0.0.255 | ||
- | # wpa-ssid | ||
- | # wpa-psk | ||
- | |||
- | ## [2] DHCP (open, WEP or WPA/WPA2): | ||
- | |||
- | ## Open Access Point (no encryption) | ||
- | #iface wlan0 inet dhcp | ||
- | # wireless-essid SSID_of_Router | ||
- | |||
- | ## WEP dhcp | ||
- | #iface wlan0 inet dhcp | ||
- | # wireless-essid SSID_of_Router | ||
- | # wireless-key | ||
- | | ||
- | ## WPA/WPA2 dhcp | ||
- | #iface wlan0 inet dhcp | ||
- | # wpa-ssid SSID_of_Router | ||
- | # wpa-psk | ||
- | |||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Multiple NICs ====== | ||
- | |||
- | http:// | ||
- | |||
- | ---- | ||
- | |||
- | |||
general_network.1588530801.txt.gz · Last modified: by gman