Jak pingować wprost z eth1 zamiast eth0


16

Próbuję wykonać polecenie ping za pomocą eth1, ale program używa eth0 (domyślne urządzenie sieciowe). Czy są jakieś porady, sztuczki lub alternatywne techniki?


Co to znaczy dokładnie wykonać polecenie ping „z” interfejsem?
David Schwartz

Odpowiedzi:


20

Z instrukcji:

  -I interface
          interface is either an address, or an interface name.  If interface is an address, it sets source
          address to specified interface address.  If interface in an interface name, it sets source inter‐
          face  to  specified  interface.   For  ping6, when doing ping to a link-local scope address, link
          specification (by the '%'-notation in destination, or by this option) is required.

Odpowiedź brzmi:

ping -I eth1 123.123.123.123

5

Użyj -Iopcji -

-I interface address
          Set  source address to specified interface address. Argument may
          be numeric IP address or name of device. When pinging IPv6 link-
          local address this option is required.

ping -I eth1 www.google.com


2

Wierzę, że skorzystanie z tej -Iopcji to wystarczy. Musiałem to zrobić raz, ale to było jakiś czas temu. Ze strony man ping:

-I adres interfejsu
Ustaw adres źródłowy na określony adres interfejsu. Argumentem może być numeryczny adres IP lub nazwa urządzenia. Podczas pingowania adresu lokalnego łącza IPv6 ta opcja jest wymagana.

Korzystając z naszej strony potwierdzasz, że przeczytałeś(-aś) i rozumiesz nasze zasady używania plików cookie i zasady ochrony prywatności.
Licensed under cc by-sa 3.0 with attribution required.