User Tools

Site Tools


linux:networking

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
linux:networking [2024/02/16 09:40] – [Linux IP Command] bstaffordlinux:networking [2026/03/21 01:04] (current) – [Show Network Data] bstafford
Line 2: Line 2:
 [[https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/|here]] [[https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/|here]]
  
 +===== Show Subnet Data =====
 +<code>sudo apt install sipcalc</code>
 +<code>sipcalc 192.168.1.0/24 -a</code>
 ===== Show Network Data ===== ===== Show Network Data =====
  
-Use <code>nmcli device show</code>+Use [[https://www.tecmint.com/configure-network-connections-using-nmcli-tool-in-linux/|nmcli]] <code>nmcli device show</code>
 or or
 <code>#!/bin/bash <code>#!/bin/bash
Line 10: Line 13:
 INTERFACE=ens34 INTERFACE=ens34
  
-echo "           Interface: $INTERFACE" +echo "         Interface: $INTERFACE" 
-ip -4 addr show $INTERFACE | grep inet | awk -F " " '{print "                IPv4: " $2}' +ip -4 addr show $INTERFACE | grep inet | awk -F " " '{print "              IPv4: " $2}' 
-ip route | grep default | awk -F " " '{print "             Gateway: " $3}' +ip route | grep default | grep "metric 100" | awk -F " " '{print "           Gateway: " $3}' 
-resolvectl -i $INTERFACE status --no-pager | awk '/DNS Server/,0'</code>+resolvectl -i $INTERFACE status --no-pager | awk '/DNS Server/,0' 
 +nmcli connection show Wired\ connection\ 1 | grep -i dhcp_server_identifier | awk -F " " '{print "       DHCP Server: " $4}'</code> 
 + 
 +Get DHCP Server 
 +<code>nmcli connection show --active 
 +nmcli connection show "<active-connection-name>" | grep -i dhcp_server_identifier</code>
 ====== Ubuntu 20.04 Static IP ====== ====== Ubuntu 20.04 Static IP ======
 set the following in ''/etc/netplan/50-static-ip'' set the following in ''/etc/netplan/50-static-ip''
linux/networking.1708076420.txt.gz · Last modified: by bstafford