ShellSpells
  • 🧙‍♂️Welcome!
    • ShellSpells
    • FAQs
    • License & Disclaimer
  • 🐧Linux
    • System Ops
      • Transcripts
      • Help
      • System Info
        • Date/Time
        • System Details
        • Patches & Updates
        • Init System Identification
        • Hostname / Host ID
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Shares
        • Packages
        • Connected Devices
        • Kernel Modules (Drivers)
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Jobs
        • Enumerate
        • Modify
      • Processes
        • Enumerate
        • Modify
        • Custom Script and Shared Object
        • Process I/O Redirection
      • Services
        • Enumerate
        • Modify
        • Create a Service
      • Startup/Boot Scripts
        • Enumerate
        • Modify
      • Security
        • Antivirus
        • Firewall
        • SSH Keys
      • History & Logs
        • History
        • Logs
    • File Ops
      • Search
        • Filename
        • Content
        • Users (Owners)
        • Time
        • Size
        • Permission
        • Hidden Files
        • Inode
        • Find + Exec
        • Notes
      • Enumerate Metadata
      • Modify Metadata
      • Read Content
      • Modify Content
      • Extract Content
      • Sort / Compare / Count
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
    • Terminal Ops
      • Keyboard Shortcuts
      • Tmux Shortcuts
  • 🪟Windows
    • System Ops
      • Transcripts
      • Help
      • System Info
        • One-liners
        • Date/Time
        • System Details
        • Hotfixes
        • Domain or Workgroup
        • Data Execution Prevention
        • Variables
        • Hardware & Resources
      • Filesystem
        • Traverse & Enumerate
        • Drives & Partitions
        • Installed Software
        • Drivers
        • Shares
      • Registry
        • Enumerate
        • Modify
        • Forensically Relevant Keys
      • Users & Groups
        • Enumerate
        • Modify
      • Network
        • Enumerate
        • Modify
      • Scheduled Tasks
      • Processes
        • Enumerate
        • Modify
      • Services
        • Enumerate
        • Modify
      • Autorun / Startup
        • Enumerate
        • Modify
      • Security
        • Permissions
          • Enumerate
          • Page
        • Antivirus
        • Firewall
          • Enumerate
          • Modify
        • Audit Policies
        • Remoting
          • Enumerate
          • Modify
          • Registry Locations
        • Stored Credentials
      • Remote Command Execution
      • Active Directory
        • Enumerate
        • Modify
      • History & Logs
        • History
        • Logs
      • PowerShell Config
      • Scripting
      • WMIC Notes
    • File Ops
      • Search
        • Filename
        • Time
        • Size
        • Permissions
        • Attributes
        • Wildcarding
      • Enumerate Metadata
        • One Liners
        • Users (Owners)
        • Timestamps
        • Size
        • Permissions
        • Attributes
      • Modify Metadata
        • Change Owner
        • Timestamps
        • Size
        • Attributes
      • Read Content
      • Modify Content
        • Overwrite
        • Insert
        • Append
        • Replace / Remove
        • Convert Case
        • Alternate Data Streams
      • Extract Content
      • Sort / Compare / Count
        • Sort
        • Count
        • Compare
      • Move
      • Copy
      • Execute
      • Hash
      • Encode/Decode
      • Compress/Decompress
      • Working With Weird Filenames
      • Output Formatting / Filtering
      • File Formatting
      • Operators
  • ⛓️Network
    • Traffic Manipulation
      • iptables
        • Option List
        • General Commands
        • Filter Tables
        • NAT
        • Mangle
        • Filter for SSH Traffic (Example)
      • nftables
    • Packet Capture
      • Syntax
      • TCPDump Examples
    • Packet Analysis
      • Wireshark
  • 🚗Maneuver
    • SSH
    • Control Sockets
    • RDP
    • Windows Port Proxy
  • 🛩️Data Transfer
    • SCP
    • FTP
    • Netcat
      • Netcat Relays
    • Server Interactions
    • Alternate Methods
  • 🪄REGEX
    • Examples
Powered by GitBook
On this page
  • NICs
  • Config Files (persistent changes)
  • ARP
  • DNS
  • Direct File Editing
  • Network Manager (if applicable)
  • dhclient
  • Distribution-Specific Tools
  • Routing Tables
  • Config Files (persistent changes)
  • Sockets

Was this helpful?

  1. Linux
  2. System Ops
  3. Network

Modify

NICs

nmtui

Provides a text user interface to easily modify network interface settings through NetworkManager.

ifconfig <interface> <IP_address> netmask <netmask>

Assigns an IP and netmask

ip link set eth0 address 00:11:22:33:44:55

Change MAC address (temporarily)

ifconfig <interface> up|down

Activates/deactivates an interface

ip addr add <IP_address>/<netmask> dev <interface>

Adds an IP and netmask

ip addr del <IP_address>/<netmask> dev <interface>

Deletes an IP from a network interface

ip link set <interface> up|down

Brings a network interface up or down

ip link set dev <interface> name <new_name>

Changes the name of a network interface.

ethtool -G <interface> rx <value> tx <value>

Changes the RX and TX ring buffer sizes for an Eth interface.

ethtool -s eth0 speed 100 duplex full autoneg on

Change speed, duplex mode, auto-negotiation

iwconfig <interface> essid <ESSID>

Sets the ESSID (network name) for a wireless network interface.

iwconfig <interface> mode <mode>

Set operating mode of a wireless interface (e.g., Managed, Master, Monitor).

iw <interface> set type <type>

Changes the type of a wireless interface (e.g., managed, monitor) using the iw command.

ip route add|del via dev

Adds or deletes a route to a network or host via a specified gateway

ethtool -s <interface> speed <speed> duplex <duplex> autoneg on|off

Changes the speed, duplex mode, and autonegotiation settings for an Ethernet interface

nmcli device modify <interface> ipv4.addresses <IP>/<netmask> ipv4.gateway <gateway> ipv4.dns "<dns_servers>"

Modifies the IP address, gateway, and DNS settings for a network interface using NetworkManager

Adds or deletes a route to a network or host via a specified gateway:

ip route add|del <destination> via <gateway> dev <interface>

Changes the speed, duplex mode, and autonegotiation settings for an Ethernet interface:

ethtool -s <interface> speed <speed> duplex <duplex> autoneg on|off

Modifies the IP address, gateway, and DNS settings for a network interface using NetworkManager:

nmcli device modify <interface> ipv4.addresses <IP>/<netmask> ipv4.gateway <gateway> ipv4.dns "<DNS_servers>"

Config Files (persistent changes)

Edit /etc/network/interfaces (Debian/Ubuntu):

Add lines like auto eth0, iface eth0 inet static, address 192.168.1.100, netmask 255.255.255.0.

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 (Red Hat/CentOS): Modify BOOTPROTO, IPADDR, NETMASK, etc.

ARP

arp -d <IP>

Deletes an ARP

ip neigh del <IP>

Deletes an ARP

ip neigh del <IP_address> dev <interface>

Deletes an ARP entry for the specified IP

arp -s <IP> <MAC>

Adds a static ARP entry

ip neigh add <IP> lladdr <MAC>

Adds a static ARP entry

ip neigh add <IP> lladdr <MAC> nud permanent dev <interface>

Adds a static ARP entry

Replaces or adds an ARP entry. If the entry for the specified IP address exists, it is updated; otherwise, a new entry is added:

ip neigh replace <IP> lladdr <MAC> nud permanent dev <interface>

Removes ARP entries matching the <selector>, which can be an IP , network, or all to clear the entire ARP cache:

ip neigh flush <selector>

DNS

Direct File Editing

Edit /etc/resolv.conf for temporary changes: Add or modify nameserver lines to specify DNS servers. Add or modify search lines to set search domains. Changes might not persist after network restarts or DHCP updates. sudo vi /etc/resolv.conf

Modify nsswitch.conf for DNS Lookup Order /etc/nsswitch.conf: This file controls the sources from which names are resolved (e.g., hosts, passwords). For DNS, you might modify the hosts: line to change the lookup order. Example command to edit: sudo vi /etc/nsswitch.conf

Network Manager (if applicable)

Use GUI or command-line tools like nmcli or nmtui to modify DNS settings via Network Manager. Changes usually persist across reboots and network changes.

nmcli: For systems using NetworkManager, nmcli can modify DNS settings. To set DNS servers on a specific connection: nmcli con mod <connection_name> ipv4.dns "<DNS_servers>" nmcli con mod <connection_name> ipv6.dns "<DNS_servers>"

To reload the connection and apply changes: nmcli con up <connection_name>

dhclient

dhclient: If your system uses DHCP to obtain network settings, including DNS, you might need to modify the DHCP client configuration to change DNS behavior. \

The configuration file might vary, but commonly /etc/dhcp/dhclient.conf is used. \

You can specify prepend domain-name-servers <DNS_server_IP>; to add custom DNS servers. \

Example command to edit dhclient.conf: sudo vi /etc/dhcp/dhclient.conf

Distribution-Specific Tools

Debian/Ubuntu: Use resolvconf to manage resolv.conf dynamically.

Red Hat/CentOS: Use systemd-resolved to manage DNS configuration. systemd-resolve or resolvectl: On systems using systemd-resolved, this tool manages DNS settings. \

To set global DNS servers: ` sudo systemd-resolve --set-dns=<DNS_server_IP> --interface=<interface_name>

To set DNS domains for searches: ` sudo systemd-resolve --set-domain= --interface=<interface_name>

Routing Tables

ip route add <network>/<prefix> via <gateway>

Add a route

route add -net <network> netmask <netmask> gw <gateway>

Add a route

ip route del <network>/<prefix>

Delete a route

route del -net <network> netmask <netmask>

Delete a route

ip route add default via <gateway>

Change the default gateway

route add default gw <gateway>

Change the default gateway

ip route flush all

Flush all routes

Config Files (persistent changes)

Edit /etc/network/interfaces (Debian/Ubuntu): Add post-up or pre-up commands to execute routing commands after interface activation.

Edit /etc/sysconfig/network-scripts/route-<interface> (Red Hat/CentOS): Add routing rules directly to configuration files.

Sockets

Adjusts the range of ports available for user-space applications:

sysctl -w net.ipv4.ip_local_port_range="1024 65535"

Enables reuse of sockets in TIME-WAIT state for new connections, affecting how sockets are managed:

sysctl -w net.ipv4.tcp_tw_reuse=1

Uses Uncomplicated Firewall (ufw) to allow or deny access to specific ports on Ubuntu and other systems:

ufw allow|deny <port>

Allows incoming TCP connections on a specific port. Modify rules to control access to sockets:

iptables -A INPUT -p tcp --dport <port> -j ACCEPT

The easiest way to open and close ports is to kill/disable the process/service using it. Otherwise, you can make firewall/iptable rules to block/allow/etc.

PreviousEnumerateNextScheduled Jobs

Last updated 1 year ago

Was this helpful?

🐧