Professional Web Applications Themes

How do I set the source address on a multi-homed host? - FreeBSD

On Sun, Feb 13, 2005 at 07:49:05PM +0200, Alin-Adrian Anton wrote: <snip> > I really don't see why you use A-class netmask. It's very probable that > a C-class netmask would suffice: They already are using a /24 (class C) network. Take another look at the mask - 0xffffff00. In any case, the network 'class' in use is not important. > rl1 inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255 > > Also, the routes for rl1 which is the internal interface don't look normal. > > You should have only one rl1 entry, like this: > > 10.0.0.0 link#2 UC 0 ...

  1. #1

    Default Re: How do I set the source address on a multi-homed host?

    On Sun, Feb 13, 2005 at 07:49:05PM +0200, Alin-Adrian Anton wrote:
    <snip>
    > I really don't see why you use A-class netmask. It's very probable that
    > a C-class netmask would suffice:
    They already are using a /24 (class C) network. Take another look at
    the mask - 0xffffff00. In any case, the network 'class' in use is not
    important.
    > rl1 inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255
    >
    > Also, the routes for rl1 which is the internal interface don't look normal.
    >
    > You should have only one rl1 entry, like this:
    >
    > 10.0.0.0 link#2 UC 0 0 rl1
    >
    > And not:
    > >10 link#2 UC 2 0 rl1
    > >10.0.0.3 00:0d:61:17:fc:30 UHLW 1 444 rl1 903
    > >10.255.255.255 ff:ff:ff:ff:ff:ff UHLWb 0 2453 rl1
    >
    > See? Why special route for 10.0.0.3?
    No, those routes are normal. They were all added to the routing table
    by FreeBSD. On the second line, the 903 is an expiration time for the
    route. I'm not sure why FreeBSD adds these temporary entries (too avoid
    having to do an ARP lookup?), but they are doented in the handbook.
    The 1st line is just a route for the subnet on the rl1 interface. The
    final is just another route for what is presumable the broadcast
    address for the rl1 network.

    Nathan

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFCEQE4O0ZIEthSfkkRAm3UAKDORt/UyqcWEl/2dDzljD7Bu7CZkgCfb2r2
    8Potx84/DexMOw6TMcmAKX0=
    =XOim
    -----END PGP SIGNATURE-----

    Nathan Kinkade Guest

  2. #2

    Default Re: How do I set the source address on a multi-homed host?

    On Sunday 13 February 2005 09:37, Jan Grant wrote:
    > On Sat, 12 Feb 2005, Daniela wrote:
    > > Yes, this happens when I connect from my machine (which functions as a
    > > router with NAT to allow the other LAN machines connect to the internet)
    > > to another LAN machine. When the router establishes a connection to
    > > another point in the intranet, the source address used is my official IP,
    > > and not 10.0.0.1, which is the intranet IP of the router.
    > > In other words, I want the source address to be 10.0.0.1 on every
    > > outgoing connection where the destination is inside my intranet.
    >
    > Assuming you haven't munged the internal IP address to hide it, and with
    > all due deference to the FreeBSD "mechanism, not policy" mantra: no, you
    > don't want to do this. The 10.0.0.0/8 block of addresses is explicitly
    > for private use and is not routable on the internet.
    >
    > If your firewall is causing problems with this setup, you might need to
    > re-examine your firewall settings.
    >
    > Having said that: technically, you specify source addresses for
    > connections by calling bind(2) prior to calling connect(2). If you fail
    > to do this, the operating system will select a source IP address for
    > you. This'll often be the IP of the outgoing interface.
    Well, if the OS selects the source IP, can't I just modify the code that
    selects it? Will this work all the time, or just when the application lets
    the OS select an address for it?
    > Unless your particular application explicitly supports the selection of
    > source addresses, you're mostly out of luck. For instance, ping(8)
    > supports this (see the -S option).
    >
    > Cheers,
    > jan
    Daniela Guest

  3. #3

    Default Re: How do I set the source address on a multi-homed host?

    On Tue, 15 Feb 2005, Daniela wrote:
    > Well, if the OS selects the source IP, can't I just modify the code that
    > selects it? Will this work all the time, or just when the application lets
    > the OS select an address for it?
    It should "just work" - that is, the source address for internal packes
    should already _be_ that of the internal interface. Your routing table
    looked good, too, IIRC. What does your NAT / ipfw configuration look
    like?

    --
    jan grant, ILRT, University of Bristol. [url]http://www.ilrt.bris.ac.uk/[/url]
    Tel +44(0)117 9287864 or +44 (0)117 9287088 [url]http://ioctl.org/jan/[/url]
    "NOP" is a trivial implementation of an executable Z subset.
    Jan Grant Guest

  4. #4

    Default RE: How do I set the source address on a multi-homed host?


    > -----Original Message-----
    > From: [email]owner-freebsd-questionsfreebsd.org[/email]
    > [mailto:owner-freebsd-questionsfreebsd.org]On Behalf Of Daniela
    > Sent: Tuesday, February 15, 2005 1:30 PM
    > To: Jan Grant
    > Cc: Alin-Adrian Anton; [email]questionsfreebsd.org[/email]
    > Subject: Re: How do I set the source address on a multi-homed host?
    >
    >
    > >
    > > Having said that: technically, you specify source addresses for
    > > connections by calling bind(2) prior to calling connect(2).
    > If you fail
    > > to do this, the operating system will select a source IP address for
    > > you. This'll often be the IP of the outgoing interface.
    >
    > Well, if the OS selects the source IP, can't I just modify the
    > code that
    > selects it? Will this work all the time, or just when the
    > application lets
    > the OS select an address for it?
    >
    Daniela,

    I have a FreeBSD 4 system setup as a NAT router, (it's real name is
    nat-rtr.freebsd-corp-net-guide.com) that has 2 interfaces, the inside
    is 192.168.1.1, the outside is 65.75.197.130

    This is in fact a real live system and I'm using it right now.

    I have several FreeBSD systems on the 192.168.1 network on the
    inside, and several FreeBSD systems on the 65.75.197 network on the
    outside.

    If I log into nat-rtr.freebsd-corp-net-guide.com (doesen't matter
    what interface I connect to) and I initiate a Telnet session from
    nat-rtr.freebsd-corp-net-guide.com to a system on the 192.168.1 network,
    once I'm logged into that system, issuing a "w -n" command shows me
    logged in from 192.168.1.1

    If on the other hand I log into a FreeBSD system that is on the
    65.75.197 network, and issue a "w -n" command, then it shows me as
    being logged in from 65.75.197.130

    If your setup isn't doing this, then it's ed. If it IS working
    this way and you think there's something wrong, then it is you that
    are ed. :-)

    Could you confirm behavior one way or another - up until now the
    explanations and your responses have been extremely fuzzy (open to
    a number of different interpretations)

    Ted
    Ted Mittelstaedt Guest

  5. #5

    Default Re: How do I set the source address on a multi-homed host?

    On Saturday 19 February 2005 07:45, Ted Mittelstaedt wrote:
    > > -----Original Message-----
    > > From: [email]owner-freebsd-questionsfreebsd.org[/email]
    > > [mailto:owner-freebsd-questionsfreebsd.org]On Behalf Of Daniela
    > > Sent: Tuesday, February 15, 2005 1:30 PM
    > > To: Jan Grant
    > > Cc: Alin-Adrian Anton; [email]questionsfreebsd.org[/email]
    > > Subject: Re: How do I set the source address on a multi-homed host?
    > >
    > > > Having said that: technically, you specify source addresses for
    > > > connections by calling bind(2) prior to calling connect(2).
    > >
    > > If you fail
    > >
    > > > to do this, the operating system will select a source IP address for
    > > > you. This'll often be the IP of the outgoing interface.
    > >
    > > Well, if the OS selects the source IP, can't I just modify the
    > > code that
    > > selects it? Will this work all the time, or just when the
    > > application lets
    > > the OS select an address for it?
    >
    > Daniela,
    >
    > I have a FreeBSD 4 system setup as a NAT router, (it's real name is
    > nat-rtr.freebsd-corp-net-guide.com) that has 2 interfaces, the inside
    > is 192.168.1.1, the outside is 65.75.197.130
    >
    > This is in fact a real live system and I'm using it right now.
    >
    > I have several FreeBSD systems on the 192.168.1 network on the
    > inside, and several FreeBSD systems on the 65.75.197 network on the
    > outside.
    >
    > If I log into nat-rtr.freebsd-corp-net-guide.com (doesen't matter
    > what interface I connect to) and I initiate a Telnet session from
    > nat-rtr.freebsd-corp-net-guide.com to a system on the 192.168.1 network,
    > once I'm logged into that system, issuing a "w -n" command shows me
    > logged in from 192.168.1.1
    >
    > If on the other hand I log into a FreeBSD system that is on the
    > 65.75.197 network, and issue a "w -n" command, then it shows me as
    > being logged in from 65.75.197.130
    No, it doesn't work this way for me. I was trying something very similar, only
    that I was using SSH instead of telnet, and it always shows me logged in from
    my outside IP. I guess it has something to do with my NAT setup, because I
    have a rule to divert all traffic to port 8668, which is open on the outside
    interface. I inserted this rule a long time ago, and all I understand about
    it is that this is necessary to let the other clients access the net.
    > If your setup isn't doing this, then it's ed. If it IS working
    > this way and you think there's something wrong, then it is you that
    > are ed. :-)
    >
    > Could you confirm behavior one way or another - up until now the
    > explanations and your responses have been extremely fuzzy (open to
    > a number of different interpretations)
    >
    > Ted
    Daniela Guest

Similar Threads

  1. Set up Multi Homed Server and CFMX 7
    By RayBees in forum Coldfusion Server Administration
    Replies: 0
    Last Post: July 27th, 03:44 PM
  2. Implications for a multi lingual, multi curreny e commerce site ??
    By James Noon in forum Dreamweaver AppDev
    Replies: 1
    Last Post: April 17th, 09:27 PM
  3. FreeBSD multi-homed w/ipnat
    By Peter Kieser in forum FreeBSD
    Replies: 2
    Last Post: February 18th, 11:05 AM
  4. Form validation for multi-rows and multi-columns
    By Jean in forum ASP Database
    Replies: 12
    Last Post: November 4th, 02:02 PM
  5. 2 NICs and the source ip address
    By Thomas Gebhardt in forum Debian
    Replies: 2
    Last Post: July 17th, 10:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139