On Wed, 8 Jun 2016 11:31:41 +0100 Stuart Henderson <s...@spacehopper.org> wrote:
> On 2016/06/08 11:59, Gerhard Roth wrote:
> > On Wed, 8 Jun 2016 10:54:00 +0100 Stuart Henderson <s...@spacehopper.org> 
> > wrote:
> > > On 2016/06/08 11:48, Gerhard Roth wrote:
> > > > 
> > > > Currently I do this to get the interface up and running as my default
> > > > route:
> > > > 
> > > >         # ifconfig umb0 pin xxxx apn xxxx
> > > >         # ifconfig umb0 inet 0.0.0.1 0.0.0.2
> > > >         # route delete default
> > > >         # route add -ifp umb0 default 0.0.0.2
> > > >         # ifconfig umb0 up
> > > > 
> > > > Yes it seem strange that the 'route add -ifp ubm0' needs an IP address,
> > > > but that's the way it is. That's why I need the fake IP address on
> > > > the interface right from the beginning. Otherwise the 'route add'
> > > > would fail.
> > > 
> > > Ah yes this is a known strangeness - the address in the "route add"
> > > can be anything at all though, it doesn't need to be configured on
> > > the interface.
> > 
> > Well, to me it looks as if we need to put it on the interface:
> > 
> >     # route add -ifp umb0 default 0.0.0.2
> >     route: writing to routing socket: Network is unreachable
> >     add net default: gateway 0.0.0.2: Network is unreachable
> >     # ifconfig ubm0 inet 0.0.0.1 0.0.0.2
> >     # route add -ifp umb0 default 0.0.0.2
> >     add net default: gateway 0.0.0.2
> > 
> 
> hmm... I wonder if that check in route addition can be relaxed,
> at least for the case where the -ifp interface is point-to-point.
> 
> I think you'll find that you *can* use an address other than
> the one configured on the interface though.
> 
> $ ifconfig pppoe1                                                             
>                          
> pppoe1: flags=48851<UP,POINTOPOINT,RUNNING,SIMPLEX,MULTICAST,INET6_NOPRIVACY> 
> mtu 1500 llprio 3
>         index 18 priority 0
>         dev: em1 state: session
>         sid: 0x1378 PADI retries: 1 PADR retries: 0 time: 1d 12:05:38
>         sppp: phase network authproto chap 
>         groups: pppoe zen egress
>         status: active
>         inet6 fe80::20d:b9ff:fe41:7e48%pppoe1 ->  prefixlen 64 scopeid 0x12
>         inet6 2a02:8011:d00e:3:225:90ff:fec0:77b5 ->  prefixlen 64
>         inet 82.68.199.142 --> 62.3.84.27 netmask 0xffffffff
> 
> # route delete default                # make sure it's cleared:
> route: writing to routing socket: No such process
> delete net default: not in table
> 
> # route add default -ifp pppoe1 1.2.3.4
> add net default: gateway 1.2.3.4

Ah, I can reproduce that: using an arbitrary IP address here succeeds if
the interface is UP but fails if it is down.


> 
> # route -n get 8.8.8.8
>    route to: 8.8.8.8
> destination: default
>        mask: default
>     gateway: 1.2.3.4
>   interface: pppoe1
>  if address: 82.68.199.142
>    priority: 8 (static)
>       flags: <UP,GATEWAY,DONE,STATIC>
>      use       mtu    expire
>      430         0         0 
> 
> # ping -c1 8.8.8.8
> PING 8.8.8.8 (8.8.8.8): 56 data bytes
> 64 bytes from 8.8.8.8: icmp_seq=0 ttl=58 time=14.027 ms
> --- 8.8.8.8 ping statistics ---
> 1 packets transmitted, 1 packets received, 0.0% packet loss
> round-trip min/avg/max/std-dev = 14.027/14.027/14.027/0.000 ms

Reply via email to