Any knowledge for sysctl?


 
Thread Tools Search this Thread
Special Forums IP Networking Any knowledge for sysctl?
# 1  
Old 01-09-2002
Any knowledge for sysctl?

HI folks. I am developing a protocol and I need to bind to an IP address that is not configured to my machine. The problem is with bind(). The sysctl system call seamed to overcome the problem of bind if you set the proc/sys/net/ipv4/ip_nonlocal_bind flag. Although I tryed to set the flag either from command line by writing sysctl -w net.ipv4.ip_nonlocal_bind=1, or echo 1>proc/sys/net/ipv4/ip_nonlocal_bind, or programmatically by using the command sysctl(), or by seting its value from the /etc/sysctl.conf file, bind still generates an error. Does anybody have any idea of why this is happening? Is there any other way to bind to a non local IP address?

PS. In the kernel configuration the sysctl support(CONFIG_SYSCTL) is enabled together with the /proc file system support (CONFIG_PROC_FS).
# 2  
Old 01-10-2002
CORRECTION
I am using raw sockets. Because with tcp or udp sockets bind() does not cause a problem. However for raw socket bind returns EADDRNOTAVAIL.

Last edited by developer; 01-10-2002 at 12:11 PM..
# 3  
Old 01-10-2002
Sounds like a very interesting problem.... however I did not fully understand what you are trying to do. Using RAW sockets requires a lot of work to set up the correct client-server socket parameters and data structures. If you are using IP, you need to look at the fields in the IP header and make sure you are building IP packets that can be properly processed on both ends.

What am I missing?
# 4  
Old 01-10-2002
What I am trying to do is to develop a micromobility protocol, i.e. a protocol that will allow users to move from one place to another while containing all the already active connections. From the TCP/IP protocol stuck point of view the protocol I am developing lyies on top of IP so I couldn't use either TCP sockets or UDP sockets only RAW sockets. RAW sockets is not a problem from the communication point of view, I already have accomplished a big part of the protocol. The problem is that a damn message requires the source IP field of the IP packet to be set to zero. Now if you try to set the address to zero (INADDR_ANY) the kernel will set the source IP address to the IP address of the outgoing interface, that applies even if you set the IP_HDRINCL socket option and try to build the IP header from scrutch. In order to prevent the kernel from changing the source IP address I tryed to set the proc.sys.net.ipv4.ip_nonlocal_bind flag as I described but still this doesn't seam to work.
To conclude I am quite sure that the code is OK and the problem is defenitelly some kernel configurations because I saw an implementation of the DHCP, which also requires the source IP address of the first message to be set to zero, and the code was the same as mine.

Last edited by developer; 01-10-2002 at 07:08 PM..
# 5  
Old 01-10-2002
For what its worth.... the linux kernal has configuration flags that allow the source address of the outgoing packet to be specified. It is a well known problem that most flavors of UNIX force the IP address of the source address to be that of the sending interface. I'm not sure about other UNIX variants, but linux has a specific kernal-build flag to 'address' this problem.
# 6  
Old 01-10-2002
Exactly. As far as I know this flag is the ip_nonlocal_bind, however when I set it bind returns an error. Do you know if there is any other flag that could overcome the problem? I forgot to mention that I am using red hat 7.1.
# 7  
Old 01-10-2002
Isn't there something about IP MASQUERADE (or something like that) when you do a make config to build a linux kernel? Did you try setting these dependencies during the kernel configuration script?
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

programming knowledge

Hi Friends, I know very well the basic commands of Unix but i want to concentrate on unix shell programming can you please how to learn and suggest me how to become comfortable level. Thanks in advance (1 Reply)
Discussion started by: victory
1 Replies

2. UNIX for Dummies Questions & Answers

sysctl help needed.(Server Hardening).

As per Hardening guide for the server. ICMP Broadcast Response: The kernel parameter icmp_echo_ignore_broadcasts must match to 1 However when i check the value of icmp_echo_ignore_broadcasts it thrown an error as unkonwn key. # sysctl icmp_echo_ignore_broadcasts error:... (2 Replies)
Discussion started by: pinga123
2 Replies

3. Linux

Anyone with Blitz PHP knowledge

Blitz PHP I am having trouble installing Blitz PHP blitz-0.6.10.tar.gz Here is what i did: cd /tmp wget blitz-0.6.10.tar.gz tar zxfv blitz-0.6.10.tar.gz cd blitz-0.6.10 And then I tried ./configure Output: -bash: No such file in directory make Output: No targets in the... (1 Reply)
Discussion started by: kendel
1 Replies

4. Shell Programming and Scripting

Knowledge

Can somebody explain me the following part within a awk command: awk '{for(i=1;i<=NF;i++) if ($i=="mm")c++} Can somebody please explain me the part (i=1;i<=NF;i++) ????:D:D:D:D (1 Reply)
Discussion started by: RubinPat
1 Replies

5. AIX

knowledge

Dear All Kindly provide me with a difference between hdiskpower and hdisk regards (2 Replies)
Discussion started by: magasem
2 Replies

6. UNIX for Dummies Questions & Answers

How to get the knowledge in UNIX? Suggest me . Please.

Hai, friends. In one exam which i have to attend in the month of january, they asked "knowledge of c and unix are required" . I am beginner to unix, even i dont know from where to start . Please suggest me what to do , to get through the exam and interview. I have already downloaded... (2 Replies)
Discussion started by: nani_ynm
2 Replies

7. UNIX for Dummies Questions & Answers

unix knowledge

I am a new Unix user looking for ways, other than time, to become an effective unix administrator. All sugestions welcome. Thanks (10 Replies)
Discussion started by: dtooth71
10 Replies
Login or Register to Ask a Question