Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision |
filter_out_unwanted_interfaces_using_grep [2023/11/09 22:59] – walkeradmin | filter_out_unwanted_interfaces_using_grep [2023/11/09 23:07] (current) – walkeradmin |
---|
veth0f16c600@if2 UP | veth0f16c600@if2 UP |
</file> | </file> |
| This may or may not be an issue, but sometimes this long list means the interfaces you are interested in will scroll off the top of the page. You could use something like head: |
| \\ |
| \\ |
| <color #ed1c24>ip -br -c a | head</color> |
| \\ |
| \\ |
| This will give an output similar to: |
| <file> |
| lo UNKNOWN 127.0.0.1/8 |
| eno1 UP 10.32.13.233/24 |
| eno2 UP 11.0.233.2/16 |
| eno3 UP 12.0.233.3/16 |
| eno4 DOWN |
| internalk3s0 UNKNOWN 192.168.255.1/24 |
| kube-ipvs0 DOWN 10.43.121.13/32 10.43.139.106/32 10.43.41.193/32 10.43.199.244/32 10.43.0.10/32 10.43.88.3/32 10.43.25.131/32 10.43.120.24/32 10.43.39.71/32 10.43.212.213/32 192.168.255.1/32 10.43.41.212/32 10.43.206.154/32 10.43.148.235/32 10.43.26.88/32 10.43.217.244/32 10.43.79.27/32 10.43.115.178/32 10.43.114.120/32 10.43.66.108/32 10.43.44.118/32 10.43.136.197/32 10.43.127.60/32 10.43.138.232/32 10.43.54.183/32 10.43.110.33/32 10.43.0.1/32 10.43.60.91/32 10.43.19.143/32 10.43.123.229/32 10.43.21.162/32 10.43.92.123/32 10.43.220.178/32 10.43.87.169/32 10.43.159.224/32 10.43.18.24/32 10.43.47.137/32 10.43.24.141/32 10.43.236.14/32 10.43.17.91/32 10.43.182.233/32 10.43.195.135/32 10.43.192.38/32 10.43.157.8/32 10.43.137.179/32 10.43.196.255/32 10.43.158.51/32 10.43.23.5/32 |
| flannel.1 UNKNOWN 10.42.0.0/32 |
| cni0 UP 10.42.0.1/24 |
| veth3d27dfa7@if2 UP |
| </file> |
| \\ |
| However, we can use GREP to filter out the unwanted entries, in this example the biggest number of unwanted entries are the 'vethxxxxxxxx' entries, we can filter these out using the following (because they all contain 'veth') |
| \\ |
| \\ |
| <color #ed1c24>ip -br -c a |grep -v veth</color> |
| \\ |
| \\ |
| <file> |
| lo UNKNOWN 127.0.0.1/8 |
| eno1 UP 10.32.13.233/24 |
| eno2 UP 11.0.233.2/16 |
| eno3 UP 12.0.233.3/16 |
| eno4 DOWN |
| internalk3s0 UNKNOWN 192.168.255.1/24 |
| kube-ipvs0 DOWN 10.43.121.13/32 10.43.139.106/32 10.43.41.193/32 10.43.199.244/32 10.43.0.10/32 10.43.88.3/32 10.43.25.131/32 10.43.120.24/32 10.43.39.71/32 10.43.212.213/32 192.168.255.1/32 10.43.41.212/32 10.43.206.154/32 10.43.148.235/32 10.43.26.88/32 10.43.217.244/32 10.43.79.27/32 10.43.115.178/32 10.43.114.120/32 10.43.66.108/32 10.43.44.118/32 10.43.136.197/32 10.43.127.60/32 10.43.138.232/32 10.43.54.183/32 10.43.110.33/32 10.43.0.1/32 10.43.60.91/32 10.43.19.143/32 10.43.123.229/32 10.43.21.162/32 10.43.92.123/32 10.43.220.178/32 10.43.87.169/32 10.43.159.224/32 10.43.18.24/32 10.43.47.137/32 10.43.24.141/32 10.43.236.14/32 10.43.17.91/32 10.43.182.233/32 10.43.195.135/32 10.43.192.38/32 10.43.157.8/32 10.43.137.179/32 10.43.196.255/32 10.43.158.51/32 10.43.23.5/32 |
| flannel.1 UNKNOWN 10.42.0.0/32 |
| cni0 UP 10.42.0.1/24 |
| </file> |
| \\ |
| If we wish to go further, we can filter out the kube/flannel/cnio etc by adding these to our command. |
| \\ |
| \\ |
| <color #ed1c24>ip -br -c a |grep -v kube |grep -v veth |grep -v internal |grep -v flannel |grep -v cni0</color> |
| \\ |
| \\ |
| This will give us a list of just the physical interfaces: |
| \\ |
| <file> |
| lo UNKNOWN 127.0.0.1/8 |
| eno1 UP 10.32.13.233/24 |
| eno2 UP 11.0.233.2/16 |
| eno3 UP 12.0.233.3/16 |
| eno4 DOWN |
| </file> |
| \\ |
| \\ |