Skip to content

Instantly share code, notes, and snippets.

@tcpdump-examples
Last active December 23, 2022 08:03
Show Gist options
  • Save tcpdump-examples/42d2caf239123dbd3a4cadb69dbeb999 to your computer and use it in GitHub Desktop.
Save tcpdump-examples/42d2caf239123dbd3a4cadb69dbeb999 to your computer and use it in GitHub Desktop.

Revisions

  1. tcpdump-examples revised this gist Dec 23, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions how-to-check-ip-address-in-Linux.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    Reference:
    [3 Easy Ways to Find IP address in Linux](https://www.howtouselinux.com/post/check-ip-address-in-linux)

    Find private ip address for all network interfaces in Linux
    ```
    ip a
  2. tcpdump-examples revised this gist Dec 23, 2022. No changes.
  3. tcpdump-examples revised this gist Dec 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion how-to-check-ip-address-in-Linux.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Reference:
    (3 Easy Ways to Find IP address in Linux)[https://www.howtouselinux.com/post/check-ip-address-in-linux]
    [3 Easy Ways to Find IP address in Linux](https://www.howtouselinux.com/post/check-ip-address-in-linux)
    Find private ip address for all network interfaces in Linux
    ```
    ip a
  4. tcpdump-examples revised this gist Dec 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion how-to-check-ip-address-in-Linux.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Reference:
    (3 Easy Ways to Find IP address in Linux)(https://www.howtouselinux.com/post/check-ip-address-in-linux)
    (3 Easy Ways to Find IP address in Linux)[https://www.howtouselinux.com/post/check-ip-address-in-linux]
    Find private ip address for all network interfaces in Linux
    ```
    ip a
  5. tcpdump-examples revised this gist Dec 23, 2022. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion how-to-check-ip-address-in-Linux.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Reference:
    (3 Easy Ways to Find IP address in Linux)(https://www.howtouselinux.com/post/check-ip-address-in-linux)
    Find private ip address for all network interfaces in Linux
    ```
    ip a
    @@ -20,4 +22,4 @@ Check public ip address in Linux
    ```
    curl ifconfig.me/all
    dig +short myip.opendns.com @resolver1.opendns.com
    ```
    ```
  6. tcpdump-examples created this gist Dec 23, 2022.
    23 changes: 23 additions & 0 deletions how-to-check-ip-address-in-Linux.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    Find private ip address for all network interfaces in Linux
    ```
    ip a
    ip addr
    ip address show
    ifconfig -a
    ```
    Check private ip address for specific network interface in Linux
    ```
    ip addr show dev eth1
    ifconfig eth1
    ```
    Check private ip address in bash script
    ```
    ip -4 -o a | cut -d ' ' -f 2,7 | cut -d '/' -f 1
    ip -4 addr show eth0 | grep -oP "(?<=inet ).*(?=/)"
    ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
    ```
    Check public ip address in Linux
    ```
    curl ifconfig.me/all
    dig +short myip.opendns.com @resolver1.opendns.com
    ```