고정 IP를 사용하여 인터페이스에 별칭을 추가하는 방법

고정 IP를 사용하여 인터페이스에 별칭을 추가하는 방법

저는 우분투 16.04 LTS에서 작업하고 있습니다. 고정 IP를 사용하여 인터페이스에 별칭을 추가하려면 docker xdebug가 필요합니다. 매뉴얼에서 실행해야 할 명령을 찾았습니다.

sudo ip addr add 10.254.254.254/24 brd + dev eth0 label eth0:1

하지만 나한테 오류가 생겼어

장치 "eth0"을 찾을 수 없습니다. 어떤 장치를 사용해야 할지 모르겠습니다. Wi-Fi를 통해 회사 네트워크에 연결했는데 ifconfig에서 다음 결과를 얻었습니다.

br-3ef36763ff4a Link encap:Ethernet  HWaddr 02:42:95:4f:d5:21  
          inet addr:172.20.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:95ff:fe4f:d521/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:285651 errors:0 dropped:0 overruns:0 frame:0
          TX packets:271008 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:921587988 (921.5 MB)  TX bytes:90682342 (90.6 MB)

br-68b224e12893 Link encap:Ethernet  HWaddr 02:42:e8:d9:24:fc  
          inet addr:172.21.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:e8ff:fed9:24fc/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:8330 (8.3 KB)

br-7de25c598e22 Link encap:Ethernet  HWaddr 02:42:8b:bc:25:72  
          inet addr:172.18.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:8bff:febc:2572/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:445 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2673 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:923525 (923.5 KB)  TX bytes:364192 (364.1 KB)

br-ea4e25d8ecec Link encap:Ethernet  HWaddr 02:42:13:41:80:08  
          inet addr:172.19.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

docker0   Link encap:Ethernet  HWaddr 02:42:3b:69:41:39  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:3bff:fe69:4139/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:12526 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21097 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:720825 (720.8 KB)  TX bytes:30520576 (30.5 MB)

enp5s0f1  Link encap:Ethernet  HWaddr 78:24:af:c8:e1:ef  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:393173 errors:0 dropped:0 overruns:0 frame:0
          TX packets:237329 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:592966216 (592.9 MB)  TX bytes:16696636 (16.6 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:92046 errors:0 dropped:0 overruns:0 frame:0
          TX packets:92046 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:850278889 (850.2 MB)  TX bytes:850278889 (850.2 MB)

veth5053565 Link encap:Ethernet  HWaddr f2:85:65:0e:e6:f8  
          inet6 addr: fe80::f085:65ff:fe0e:e6f8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5154 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5462 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:71662571 (71.6 MB)  TX bytes:528330 (528.3 KB)

veth33345b7 Link encap:Ethernet  HWaddr fe:15:f6:de:7f:1e  
          inet6 addr: fe80::fc15:f6ff:fede:7f1e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3646 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2719 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:44261915 (44.2 MB)  TX bytes:43869439 (43.8 MB)

vethc1c7bd6 Link encap:Ethernet  HWaddr 0e:75:6d:c4:8e:1a  
          inet6 addr: fe80::c75:6dff:fec4:8e1a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6367 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5782 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:44248850 (44.2 MB)  TX bytes:71727816 (71.7 MB)

vethf6abb7f Link encap:Ethernet  HWaddr 12:4f:c3:8a:1c:7d  
          inet6 addr: fe80::104f:c3ff:fe8a:1c7d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:894 (894.0 B)  TX bytes:16602 (16.6 KB)

wlp4s0    Link encap:Ethernet  HWaddr 40:e2:30:70:5a:e1  
          inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::460b:a17d:e48b:2461/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2030711 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1347090 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2881848123 (2.8 GB)  TX bytes:148307685 (148.3 MB)

wlp4s0:1  Link encap:Ethernet  HWaddr 40:e2:30:70:5a:e1  
          inet addr:10.254.254.254  Bcast:10.254.254.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

답변1

ip addr add새 장치를 생성할 수 없습니다(의도가 아닐 수도 있음). 따라서 먼저 별칭을 추가하려는 기존 장치를 찾은 다음 대신 해당 이름을 사용해야 합니다 eth0.

관련 정보