CodeRef
CodeRef
  • Software
    • VSCode
  • Midjourney_AI
    • Midjourney Cheat Sheet
  • aws
    • S3 Reference
    • Services
  • bash
    • .bashrc File Contents
    • CAN
    • _System Config File Locations
    • argument-length-limits
    • Conditionals
    • Data Structures
    • File Permissions
    • File Syncing
    • File System
    • Functions
    • General
    • Loops
    • My Functions
    • Networking
    • Number Operations
    • OpenVPN
    • Operators
    • Resource Management
    • Serial RS232
    • Spinning Wheel Animation
    • SSH
    • Text Operations
    • Environment Variables
  • cpp
    • ChatGPT | Pointers vs. References
    • arrays
    • Classes
    • Data Types / Structures
    • Enumerated Classes
    • Exception Handling
    • Function Objects
    • Functions
    • I/O
    • Loops
    • Macros
    • Namespaces
    • New Features
    • Pointers
    • Scope
    • Smart Pointers
    • Raw String Literals
    • Style Guide
    • Switch Case
    • Templating
    • How to Use tinyxml2
    • Useful Libraries
    • google-test
    • Conditionals
    • Rule of Three/Five
    • Optional Parameters
    • Keywords
    • Filesystem
    • Random
    • Casting
    • tools
  • git
    • Code Review Dependency Strategy
    • Git Bisect Guide
    • Git Reference
    • removing-cherry-picks
    • Useful Tools
    • Graphite Reference
  • js
    • functions
    • Javascript Reference
  • linux
    • Display
    • Dual Boot with Windows
    • File System
    • NVIDIA
    • Sending/Receiving TCP/UDP Messages in Ubuntu
    • dynamically_linked_binaries
  • markdown
    • Images
    • obsidian-reference
  • python
    • Classes
    • Exceptions
    • Functions
    • Operations
    • Python Reference
    • unittest_command-line-args
    • unittest_magicmock_GPT
    • unittest_mock
    • unittest_printing
    • unittest_subtest
    • useful-stuff
    • jupyter
    • poetry
  • ros
    • _ROS Cheat Sheet
    • Create New Workspace
    • Install ROS
    • Node Sample - Listener
    • Node Sample - Talker
    • Node Template
    • Setup
    • urdf
  • excel
    • excel-reference
  • windows
    • File System
    • WSL - Windows Subsystem for Linux
    • WSL
  • software_engineering
    • uncle_bob_lectures
      • Overview
      • Lesson 01 - Notes
  • web
    • Front End
    • Hugo
    • new_frontend_tools
  • sql
    • cheatsheet
Powered by GitBook
On this page
  1. bash

Networking

# See hostname and all IP addresses associated
# with the client.
hostname
hostname -I
# Get IP address and network info
ifconfig # (old, deprecated)
# or (following are all the same)
ip address
ip addr
ip add
ip a
# Show current default gateway.
ip route
ip route show # (equivalent)
# List all available network interfaces.
ip link show
# List all nodes on the network and their info.
nmap 10.133.0.*
	# Lists all nodes within this subnet.
# Set network configuration in Ubuntu.
# This includes setting static IP, gateway, netmask, etc.
# for each network adapter.
sudo vim /etc/network/interfaces
# Add any of the following lines under
# the relevant adapter(s) as needed.
address 192.168.1.58 # static client IP
netmask 255.255.255.0 # static netmask
gateway 192.168.1.1 # static gateway
# Apply changes.
sudo systemctl restart networking
# Restart networking service to
# apply any changes made to
# network configurations.
sudo systemctl restart networking
# Check internet connection.
ping 1.1.1.1 # (Cloudflare DNS server)
# Check DNS status (which DNS is active).
systemd-resolve --status
	# Active DNS IP should appear at the
	# top of the output if one is active.
# Set the DNS servers in Ubuntu.
sudo vim /etc/systemd/resolved.conf
	# Under section "[Resolve]"...
	# Edit the following lines:
		DNS=1.1.1.2
		FallbackDNS=1.0.0.2
# Apply DNS changes.
service systemd-resolved restart
# List active TCP connections (deprecated in favor of 'ss').
netstat
# List active TCP connections.
ss
# Open, close, transmit messages, and scan ports over TCP and UDP.
netcat
# Simple firewall manager for linux.
# Allow or deny access to specific ports.
# Interface to IP tables.
ufw
# Test network speed
tcptrack
iperf
iftop

Last updated 1 year ago