ravibhuva9955
ravibhuva9955

Reputation: 199

kernel system call inplace of "route" command to add host ip to routing table

I need to traverse all data packets of ftp server host from ppp0 interface, So for that i am using below command which add ftp ip address to route entry with specific gateway.

route add -host ftpaddress.com gw 10.64.64.64 dev ppp0

It is working fine but i observe sometime command is taking too much time in execution. I think it is because of ftp server address resolution. I want to do same operation using kernel system calls. Can anyone give me direction or some of hits from which i can add, delete or get ftp ip in/from route entries with specific configuration.

Or if there are any other way to do so then please let me know.

Upvotes: 0

Views: 902

Answers (1)

hek2mgl
hek2mgl

Reputation: 158190

If it is a problem with (reverse) DNS resolution, you can pass the option -n (numeric) to route. Then route will not issuing any DNS queries at all.

route add -n -host host_address gw 10.64.64.64 dev ppp0

Also you can put the hostname and IP into /etc/hosts on your box. Having default /etc/nsswitch confiugration, this file will get considered before any DNS query gets issued:

/etc/hosts

10.64.64.64 vpn.gateway.local #or whatever hostname

Upvotes: 1

Related Questions