how to get ip address of a PPP(Point-to-Point Protocol) network interface?

7,593

You didn't say what distribution you are using, but it looks like your w1g1 interface does not even have an IP address.

My suggestion is to bring pppd down and restart it.

On most distributions, the easy way is to use these commands:

ifdown w1g1
ifup w1g1

If that doesn't work and you are not trying this remotely, you might want to stop all networking and restart it:

service network stop
service network start
Share:
7,593

Related videos on Youtube

Xsmael
Author by

Xsmael

Updated on September 18, 2022

Comments

  • Xsmael
    Xsmael almost 2 years

    I have a Linux machine with two network interfaces, and I'd like to get the IP address of the PPP interface w1g1 but it doesn't show up in ifconfig. There is a public IP on the PPP interface, but there is no internet connection, I'm trying to troubleshoot but I need to get the IP address of the interface and I can't.

    ifconfig :

    eth0      Link encap:Ethernet  HWaddr 00:30:48:8D:F0:2C
              inet addr:192.168.2.254  Bcast:192.168.2.255  Mask:255.255.255.0
              inet6 addr: fe80::230:48ff:fe8d:f02c/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:9970 errors:0 dropped:567 overruns:0 frame:0
              TX packets:4338 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:100
              RX bytes:1441024 (1.3 MiB)  TX bytes:915814 (894.3 KiB)
    
    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:16436  Metric:1
              RX packets:675 errors:0 dropped:0 overruns:0 frame:0
              TX packets:675 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:50659 (49.4 KiB)  TX bytes:50659 (49.4 KiB)
    
    w1g1      Link encap:Point-to-Point Protocol
              UP POINTOPOINT RUNNING NOARP  MTU:240  Metric:1
              RX packets:748994 errors:0 dropped:0 overruns:0 frame:0
              TX packets:748992 errors:0 dropped:0 overruns:0 carrier:3
              collisions:0 txqueuelen:100
              RX bytes:179758560 (171.4 MiB)  TX bytes:179758080 (171.4 MiB)
              Interrupt:177 Memory:f881c400-f881e3ff
    

    w1g1 is connected to a modem by an RJ45<->Serial cable and the modem is connected to the phone line. The modem is a NOKIA DNT2Mi you can see it here

    Routing table :

    192.168.2.0/24 dev eth0  proto kernel  scope link  src 192.168.2.254
    169.254.0.0/16 dev eth0  scope link
    default via 192.168.2.180 dev eth0
    
    • Admin
      Admin almost 10 years
      There is no IP on that interface, and that's most likely why you don't have an internet connection.
    • Philip
      Philip almost 10 years
      Sidenote: ifconfig is deprecated in Linux now. You should be using ip.
    • Xsmael
      Xsmael almost 10 years
      @AndréDaniel But when i ping the Ip address supposed to be on that interface it answers,how can you explain that ? (I do the ping from the same computer, it't not working elsewhere )
    • PersianGulf
      PersianGulf almost 10 years
      Do you have ping through-t : ping -I w1g1 8.8.8.8 ?
    • Admin
      Admin almost 10 years
      @Xsmael are you sure your ping isn't going through eth0 instead ? Can you edit your question and add the current routing table, accessible with route or ip route show (if I remember right) ?
    • Xsmael
      Xsmael almost 10 years
      it's not working, here is the result: connect: No such device
    • Xsmael
      Xsmael almost 10 years
      @AndréDaniel You're right, I updated the post with the routing table, but even when I ping that public IP from another network it doesn't answer. and it was working 1week ago, I don't know what happened.
    • Jeff Barnard
      Jeff Barnard almost 10 years
      Have you tried restarting pppd on both ends? If that doesn't work, as a workaround i think you should add IP and routes manually.
    • Admin
      Admin almost 10 years
      Also, what is the modem's make/model ? And did this even work before ? Looking at the cable I'm pretty sure it won't work because you need more than a dumb cable like that to convert Ethernet to serial, unless the modem is already outputting Ethernet but on a serial connector.
    • Xsmael
      Xsmael almost 10 years
      @LatinSuD is pppd a service or something ? I can't restart it with service ... restart how should I do it ?
    • Jeff Barnard
      Jeff Barnard almost 10 years
      Rather, restart the modem and the computer?
    • Xsmael
      Xsmael almost 10 years
      @AndréDaniel the modem is a NOKIA DNT2Mi. Yes it was working before, I don't know what happened. and the modem has no other ouputs than the serial port. so, we are a obliged to use that "dumb" cable.
    • Xsmael
      Xsmael almost 10 years
      @LatinSuD Already done that! but no way.
    • xnor
      xnor almost 10 years
      Run: ip addr show dev <device> The output should contain inet x.x.x.x/x if the interface has an IPv4 address.
    • Xsmael
      Xsmael almost 10 years
      @xnor It doesn't show an Ip address but this: 6: w1g1: <POINTOPOINT,NOARP,UP> mtu 240 qdisc pfifo_fast qlen 100 link/ppp
    • Admin
      Admin almost 10 years
      I'm confused, how do you even start the PPP connection in the first place ? Can you add your pppd configuration files ?
    • Xsmael
      Xsmael almost 10 years
      it was not me who configured that PPP connection I even never heard about it, I was a bit suprised when I saw it after running ifconfig The guy who did it is gone, so if you can tell me the path of configuration files i'll post it!
  • Xsmael
    Xsmael almost 10 years
    ok, Tried to restart the network interface w1g1, with ifdown w1g1 and ifup w1g1' but surprisingly it doesn't work, it answers usage: ifdown <device name>` it's like it doesn't recognize w1g1 even though that name appears when i run ifconfig.
  • Xsmael
    Xsmael almost 10 years
    There are two interfaces: one for LAN(private IP) and the other for WAN(public IP), I can ping both IP addresses with no problem, but when I run ifconfig the ip address of w1g1 doesn't appear as you can see on my post but when I ping his ip address it answers!
  • Xsmael
    Xsmael almost 10 years
    whent restart the network service, all the interfaces are restarted except w1g1. do you know what's happening ?
  • Scott Nelson
    Scott Nelson almost 10 years
    The ifup/ifdown/service network start/stop commands all depend on configuration files in /etc/sysconfig/network-scripts called ifcfg-XXX (where XXX is the device name). The linux kernel itself does not depend on those files, so other programs/scripts/commands can be used to create interfaces as well, but I can't help without more information about what command was used to create w1g1.