0

I am just curious, is there any way to allot any IP (out of multiple IPs) to any application? here I have two IP's one from wireless network interface, and another through wired network interface.

 $ ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:26:55:b6:36:b3  
              inet addr:192.168.1.15  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::226:55ff:feb6:36b3/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:4680 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4685 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:1940449 (1.9 MB)  TX bytes:840513 (840.5 KB)
              Interrupt:17 

    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:65536  Metric:1
              RX packets:3367 errors:0 dropped:0 overruns:0 frame:0
              TX packets:3367 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:295745 (295.7 KB)  TX bytes:295745 (295.7 KB)

    wlan0     Link encap:Ethernet  HWaddr 00:1e:65:4f:c4:ca  
              inet addr:192.168.1.8  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::21e:65ff:fe4f:c4ca/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:59170 errors:0 dropped:0 overruns:0 frame:0
              TX packets:52111 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:64119125 (64.1 MB)  TX bytes:7433147 (7.4 MB)

Is there any way to distribute these two IP's among various processes,and how can I do it?? Another query, how many IP's a normal user laptop can have at max??

2

2 Answers 2

2

Depending on how you do it, you can have 32768 or 4294967296 IPs.

The Linux kernel supports 32768 interfaces according to this random discussion on the internet, supported by net/core/dev.c.

 *    duplicates.
 *    Limited to bits_per_byte * page size devices (ie 32K on most platforms).
 *    Returns the number of the unit assigned or a negative errno code.
 */

static int __dev_alloc_name(struct net *net, const char *name, char *buf)

So if you have one address per interface, that's the limit. You can assign alias IPs to interfaces, so maybe you can assign all the available IPv4 addresses to it. (Or maybe 3.4×10^38 with IPv6).

(Of course, with physical interfaces, and one IP per interface, the answer depends on your motherboard.)

1

The IP address being used by a application depends on the IP address the application 'binds' on. Normally (unless its a server application) binds to 0.0.0.0. Which means that the kernel will decide what IP address to use.

About the max amount of IP addresses. There's actually no limit. IP addresses are software based and there is no actual limit.436 reputation 210

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .