Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 2 Interfaces. One for WAN and other for Internet (this one does not have National Internet Exchange routing). I usually find IP from a peer in my area and then search it in apnic.net. There I use only 2 fields, inetnum and route.

For example I search this IP XXX.YYY.7.117. Searhing this on apnic I find following two fields.

inetnum:        XXX.YYY.0.0 - XXX.YYY.31.255
route:          XXX.YYY.7.0/24

What I want is to pass all the traffic for these IPs (inetnum) to WAN interface. If I calculate the range I find CIDR notation XXX.YYY.0.0/19. So XXX.YYY.0.0/19 contains all the IPs found in inetnum range. But the route has XXX.YYY.7.0/24. Both are different. Which should I use when adding this to my routing table?

Which of the following commands will serve my purpose?

route add -net `XXX.YYY.0.0/19` gw MY_IP dev WAN
route add -net `XXX.YYY.7.0/24` gw MY_IP dev WAN
share|improve this question
    
do you have more than one WAN interface? BTW, I don't see a "route" field in apnic's public API docs. Can you provide a real example query? –  Mike Pennington Jul 31 '12 at 7:15
    
I have 2 gateways or nic. Both have internet access. eth1 is for local traffic (MAN). eth0 is for Internet. –  Shiplu Jul 31 '12 at 7:18
    
If your only internet is eth0, then why bother looking up routes? The only unknown destinations should be out eth0, correct? –  Mike Pennington Jul 31 '12 at 7:20
    
@MikePennington search this ip on apnic 58.97.129.36 –  Shiplu Jul 31 '12 at 7:20
    
All default destination will be passed to eth0. But I have some MAN ips those should be passed to eth1. Because they are in same area so I get low ping –  Shiplu Jul 31 '12 at 7:21
show 8 more comments

1 Answer

up vote 2 down vote accepted

When I lookup 58.97.129.36, there is no confusion about prefix length... APNIC lists this as a /17 block. Therefore, you should add this route as a /17 out the appropriate WAN / MAN connection.

You really should consider a static default out your WAN interface and then run BGP with those destinations out your MAN, it's far easier to manage routes with a dynamic protocol. This would require a real router (instead of host-level routing you're doing now), but I think in the long-run you'll have a more maintainable network.


$ gwhois -h whois.arin.net 58.97.129.36

Process query: '58.97.129.36'
Querying whois.arin.net:43 with whois.
Querying whois.apnic.net:43 with whois.


% [whois.apnic.net node-3]
% Whois data copyright terms    http://www.apnic.net/db/dbcopyright.html

inetnum:        58.97.128.0 - 58.97.255.255
netname:        BANGLALION-WIMAX-BD
descr:          Silver Tower (16 & 18th Floor)
country:        BD
admin-c:        BCLn1-AP
tech-c:         BCLn1-AP
status:         ALLOCATED PORTABLE
remarks:        Used for WiMAX
mnt-by:         APNIC-HM
mnt-lower:      MAINT-BANGLALION-WIMAX-BD
mnt-routes:     MAINT-BANGLALION-WIMAX-BD
mnt-irt:        IRT-BANGLALION-WIMAX-BD
remarks:        -+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+
remarks:        This object can only be updated by APNIC hostmasters.
remarks:        To update this object, please contact APNIC
remarks:        hostmasters and include your organisation's account
remarks:        name in the subject line.
remarks:        -+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+
changed:        hm-changed@apnic.net 20110107
source:         APNIC

route:          58.97.128.0/17
descr:          Route Object for 58.97.128.0.0/17
origin:         AS45904
country:        BD
remarks:        New /17 block of Banglalion WiMAX
mnt-lower:      MAINT-BANGLALION-WIMAX-BD
mnt-routes:     MAINT-BANGLALION-WIMAX-BD
mnt-by:         MAINT-BANGLALION-WIMAX-BD
changed:        hm-changed@apnic.net 20110117
source:         APNIC

role:           BANGLALION COMMUNICATIONS LTD - network administr
address:        Silver Tower (16 & 18th Floor), 52 Gulshan Avenue, Gulshan, Dhaka-1212. Bangladesh.
country:        BD
phone:          +88028816349
fax-no:         +8802-9885647
e-mail:         azhar.chowdhury@banglalionwimax.com
admin-c:        BCLn1-AP
tech-c:         AHC2-AP
nic-hdl:        BCLn1-AP
mnt-by:         MAINT-BANGLALION-WIMAX-BD
changed:        hm-changed@apnic.net 20090831
source:         APNIC
changed:        hm-changed@apnic.net 20100825





--
  To resolve one of the above handles: whois -h whois.arin.net HANDLE
  OTOH offical handles should be recognised directly.
  Please report errors or misfits via the debian bug tracking system.

$ gwhois -h whois.arin.net 123.200.7.22
Process query: '123.200.7.22'
Querying whois.arin.net:43 with whois.
Querying whois.apnic.net:43 with whois.


% [whois.apnic.net node-2]
% Whois data copyright terms    http://www.apnic.net/db/dbcopyright.html

inetnum:        123.200.0.0 - 123.200.31.255
netname:        LINK3
descr:          Link3 Technologies Ltd.
descr:          Internet Service Provider, Dhaka, Bangladesh
country:        BD
admin-c:        SP349-AP
tech-c:         SP349-AP
mnt-by:         APNIC-HM
mnt-lower:      MAINT-BD-LINK3
mnt-routes:     MAINT-BD-LINK3
status:         ALLOCATED PORTABLE
remarks:        -+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+
remarks:        This object can only be updated by APNIC hostmasters.
remarks:        To update this object, please contact APNIC
remarks:        hostmasters and include your organisation's account
remarks:        name in the subject line.
remarks:        -+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+
changed:        hm-changed@apnic.net 20070111
source:         APNIC

route:          123.200.7.0/24
descr:          route object for 123.200.7.0/24
country:        BD
origin:         AS23688
mnt-lower:      MAINT-BD-LINK3
mnt-routes:     MAINT-BD-LINK3
mnt-by:         MAINT-BD-LINK3
changed:        qmesbah@link3.net 20110829
source:         APNIC

person:         Sajjid Pasha
address:        Bulu Ocean Tower, 17th Floor,
address:        40, Kemal Ataturk Avenue, Banani,
address:        Dhaka 1213
address:        Bangladesh
country:        BD
phone:          +88-02-9894500
fax-no:         +88-02-9888642
e-mail:         apnic@link3.net
nic-hdl:        SP349-AP
mnt-by:         MAINT-BD-LINK3
changed:        biddut@link3.net 20101127
source:         APNIC





--
  To resolve one of the above handles: whois -h whois.arin.net HANDLE
  OTOH offical handles should be recognised directly.
  Please report errors or misfits via the debian bug tracking system.

$ telnet route-views.oregon-ix.net
Trying 128.223.51.103...
Connected to route-views.oregon-ix.net.
Escape character is '^]'.

 **********************************************************************

                    Oregon Exchange BGP Route Viewer
          route-views.oregon-ix.net / route-views.routeviews.org

 route views data is archived on http://archive.routeviews.org

 This hardware is part of a grant from Cisco Systems.
 Please contact help@routeviews.org if you have questions or
 comments about this service, its use, or if you might be able to
 contribute your view.

 This router has views of the full routing tables from several ASes.
 The list of ASes is documented under "Current Participants" on
 http://www.routeviews.org/.

                          **************

 route-views.routeviews.org is now using AAA for logins.  Login with
 username "rviews".  See http://routeviews.org/aaa.html

 **********************************************************************


User Access Verification

Username: rviews
route-views>sh ip route 123.200.7.22
Routing entry for 123.200.0.0/21
  Known via "bgp 6447", distance 20, metric 0
  Tag 1239, type external
  Last update from 144.228.241.130 1d21h ago
  Routing Descriptor Blocks:
  * 144.228.241.130, from 144.228.241.130, 1d21h ago
      Route metric is 0, traffic share count is 1
      AS Hops 7
      Route tag 1239

route-views>
share|improve this answer
    
Please search 123.200.7.22. It has inetnum /16 but route is /24. This is the exact scenario I am facing. –  Shiplu Jul 31 '12 at 7:27
    
In the case of 123.200.7.22, APNIC indeed shows a /24, but if you look it up on a bgp route-reflector it's a /21. You should use BGP route-reflectors as your authoritative source for prefix lengths. Better-yet, run BGP with your MAN peers and forget about this static-routing insanity –  Mike Pennington Jul 31 '12 at 7:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.