Forum SubscriptionsForum Subscriptions   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Web server behind Vyatta Browse Issue
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Vyatta.org Forum Index -> Users
View previous topic :: View next topic  
Author Message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Thu Jan 29, 2009 10:30 am    Post subject: Web server behind Vyatta Browse Issue Reply with quote

Hello,

Using Vyatta 5 Beta

I have a test web server and a laptop configured behind Vyatta.
I have opened Ports 80 and 21 for FTP on the server
I have configred a Source NAT for the Laptop to surf the Internet.

The issue that I have is I can access the target FTP and Web HTML test page from another network. But I cannot see the web page or the FTP from the laptop that is also behind Vyatta.


Thanks
Joseph
Back to top
View user's profile Send private message
conceptcoders
Active Member
Active Member


Joined: 29 Feb 2008
Posts: 29

PostPosted: Thu Jan 29, 2009 2:41 pm    Post subject: Reply with quote

At a stab at a guess, chances are your trying to access the server via the external IP.

If that's the case then you need to add an extra NAT rule.

e.g.
You've probably got something like:

rule 1 {
destination {
address 1.1.1.1
}
inbound-interface eth0
inside-address {
address 10.0.0.1
}
protocol all
type destination
}

However, I'm assuming your internal network is on a different interface from eth0. The above rule only works if inbound traffic originates from eth0.
Assuming your internal network is on eth1, you'd need to add

rule 2 {
destination {
address 1.1.1.1
}
inbound-interface eth1
inside-address {
address 10.0.0.1
}
protocol all
type destination
}

It would help if you could post a little more about your network layout though.
Back to top
View user's profile Send private message
conceptcoders
Active Member
Active Member


Joined: 29 Feb 2008
Posts: 29

PostPosted: Thu Jan 29, 2009 2:46 pm    Post subject: Reply with quote

In fact, we've got a bit of an issue with this ourselves. Currently Vyatta forces you to setup rules like this for each inbound interface.
We have around 50 vlans, and if we want all of them to be able to access a server, then we have to add 50 rules to our setup!
Which is a pain to say the least.
IMO, It would be much better to able to say inbound-interface any
Since there is a limit of 1024 rules for NAT, this is a problem if you have a sizeable number of interfaces virtual or otherwise.
The same goes for outbound rules!

rule 1 {
destination {
address 1.1.1.1
}
inbound-interface any
inside-address {
address 10.0.0.1
}
protocol all
type destination
}
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Thu Jan 29, 2009 6:11 pm    Post subject: Reply with quote

Thanks for the info,

I am going to post my config and then see what is going on. I am not in the office now just replying to your message. Good to hear that I am not the only one.

Thanks
Joseph
Back to top
View user's profile Send private message
robyn
Vyatta Employee
Vyatta Employee


Joined: 22 Feb 2008
Posts: 242

PostPosted: Fri Jan 30, 2009 6:39 am    Post subject: Reply with quote

Regarding the 'inbound interface any' option, you can use "inbound-interface eth+". That should match any interface name that begins with eth (in other words, all VLANS). I have not tested this with VLANS but I know it works well with multiple Ethernet interfaces.

Thanks,

Robyn
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Sat Jan 31, 2009 10:27 am    Post subject: Reply with quote

conceptcoders wrote:
In fact, we've got a bit of an issue with this ourselves. Currently Vyatta forces you to setup rules like this for each inbound interface.
We have around 50 vlans, and if we want all of them to be able to access a server, then we have to add 50 rules to our setup!
Which is a pain to say the least.
IMO, It would be much better to able to say inbound-interface any
Since there is a limit of 1024 rules for NAT, this is a problem if you have a sizeable number of interfaces virtual or otherwise.
The same goes for outbound rules!

rule 1 {
destination {
address 1.1.1.1
}
inbound-interface any
inside-address {
address 10.0.0.1
}
protocol all
type destination
}


here is my config the Laptop is at 111.10 and yest my interface for the LAN is on eth1 so is the server
Code:

login as: vyatta
vyatta@10.10.111.254's password:
Linux vyatta 2.6.26-1-486-vyatta #1 SMP Thu Nov 27 00:09:42 GMT 2008 i686
Welcome to Vyatta.
This system is open-source software. The exact distribution terms for
each module comprising the full system are described in the individual
files in /usr/share/doc/*/copyright.
Last login: Fri Jan 30 20:42:17 2009
vyatta@MGR1:~$ configure
[edit]
vyatta@MGR1# show service nat
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 200 {
     description LAPTOP1:1
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
:
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 200 {
     description LAPTOP1:1
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.20
     }
     protocol all
     source {
         address 10.10.111.10
     }
     type source
 }
~
~
~
~
~
~
~
~
~
~
~
~
[edit]
vyatta@MGR1# show service nat
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 200 {
     description LAPTOP1:1
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.20
     }
     protocol all
     source {
         address 10.10.111.10
     }
     type source
 }
[edit]
vyatta@MGR1#


What am I missing that I cannot browse the server website and other Vyatta networked devices? My brain gets twisted with this Inbound outbound stuff on this type or CLI router

Thanks
Joseph
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Sat Jan 31, 2009 6:15 pm    Post subject: Reply with quote

I have tried this method posted and I am not having any luck at all.

I can browse the server via the internal ip just not the public IP

If the server is nated in 75.147.211.17 to 10.10.111.200

and the Laptop is nated to 75.147.211.20 to 10.10.111.10

How do these rule apply> Is the "inbound-interface any" for the laptop or the server? Or both?


Thanks
Joseph
Back to top
View user's profile Send private message
stig
Vyatta Employee
Vyatta Employee


Joined: 21 Feb 2008
Posts: 1282
Location: silicon valley

PostPosted: Sat Jan 31, 2009 7:36 pm    Post subject: Reply with quote

Joseph wrote:
I have tried this method posted and I am not having any luck at all.

I can browse the server via the internal ip just not the public IP

If the server is nated in 75.147.211.17 to 10.10.111.200

and the Laptop is nated to 75.147.211.20 to 10.10.111.10

How do these rule apply> Is the "inbound-interface any" for the laptop or the server? Or both?


Thanks
Joseph
It sounds like your nat rule to get from the public address to the private is working, but not the private to public. Does "show nat translations" show any translations occurring?

You haven't shown your config for your interfaces so we don't know if 75.142.211.20 is configured on eth0. Instead of using a source NAT rule have you tried using a simple masquerade rule like:
Code:
 service {
     nat {
         rule 10 {
             outbound-interface eth0
             type masquerade
         }
     }
  }
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Sat Jan 31, 2009 8:49 pm    Post subject: Reply with quote

Hey Stig thanks for jumping in

I can surf the net fine just can't hit the server that is on Vyatta network from the laptop on the external IP. Here is all my new configs
Code:

login as: vyatta
vyatta@10.10.111.254's password:
Linux MGR1 2.6.26-1-486-vyatta #1 SMP Thu Nov 27 00:09:42 GMT 2008 i686
Welcome to Vyatta.
This system is open-source software. The exact distribution terms for
each module comprising the full system are described in the individual
files in /usr/share/doc/*/copyright.
Last login: Sun Feb  1 04:13:27 2009
vyatta@MGR1:~$ show interfaces
Interface    IP Address         State       Link   Description
eth0         75.147.211.17/28   up          up     WAN
eth0         75.147.211.20/28   up          up     WAN
eth0         75.147.211.21/28   up          up     WAN
eth1         10.10.111.254/24   up          up     LAN
lo           127.0.0.1/8        up          up
lo           ::1/128            up          up
vyatta@MGR1:~$ show nat translations
Pre-NAT              Post-NAT             Type  Prot  Timeout
10.10.111.10         75.147.211.20        snat  tcp   431723
vyatta@MGR1:~$ show service nat
Invalid command
vyatta@MGR1:~$ configure
[edit]
vyatta@MGR1# show service nat
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 11 {
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.17
:
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 11 {
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.17
     }
     source {
         address 10.10.111.200
     }
     type source
 }
 rule 15 {
     destination {
         address 0.0.0.0/0
     }
     inbound-interface any
     inside-address {
         address 10.10.111.10
     }
     outside-address {
         address 75.147.211.20
     }
     type destination
 }
 rule 16 {
[edit]
vyatta@MGR1# show nat translations
Specified configuration path is not valid
[edit]
vyatta@MGR1# exit
exit
vyatta@MGR1:~$ show nat translations
Pre-NAT              Post-NAT             Type  Prot  Timeout
10.10.111.10         75.147.211.20        snat  tcp   4
10.10.111.200        75.147.211.17        snat  udp   14
10.10.111.10         75.147.211.20        snat  tcp   4
10.10.111.10         75.147.211.20        snat  tcp   431588
vyatta@MGR1:~$


That is the only issue I have. I will test with the masquerade method and post back.

Thanks
Joseph
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Sat Jan 31, 2009 9:00 pm    Post subject: Reply with quote

Code:
login as: vyatta
vyatta@10.10.111.254's password:
Linux MGR1 2.6.26-1-486-vyatta #1 SMP Thu Nov 27 00:09:42 GMT 2008 i686
Welcome to Vyatta.
This system is open-source software. The exact distribution terms for
each module comprising the full system are described in the individual
files in /usr/share/doc/*/copyright.
Last login: Sun Feb  1 04:13:27 2009
vyatta@MGR1:~$ show interfaces
Interface    IP Address         State       Link   Description
eth0         75.147.211.17/28   up          up     WAN
eth0         75.147.211.20/28   up          up     WAN
eth0         75.147.211.21/28   up          up     WAN
eth1         10.10.111.254/24   up          up     LAN
lo           127.0.0.1/8        up          up
lo           ::1/128            up          up
vyatta@MGR1:~$ show nat translations
Pre-NAT              Post-NAT             Type  Prot  Timeout
10.10.111.10         75.147.211.20        snat  tcp   431723
vyatta@MGR1:~$ show service nat
Invalid command
vyatta@MGR1:~$ configure
[edit]
vyatta@MGR1# show service nat
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 11 {
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.17
:
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 11 {
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.17
     }
     source {
         address 10.10.111.200
     }
     type source
 }
 rule 15 {
     destination {
         address 0.0.0.0/0
     }
     inbound-interface any
     inside-address {
         address 10.10.111.10
     }
     outside-address {
         address 75.147.211.20
     }
     type destination
 }
 rule 16 {
[edit]
vyatta@MGR1# show nat translations
Specified configuration path is not valid
[edit]
vyatta@MGR1# exit
exit
vyatta@MGR1:~$ show nat translations
Pre-NAT              Post-NAT             Type  Prot  Timeout
10.10.111.10         75.147.211.20        snat  tcp   4
10.10.111.200        75.147.211.17        snat  udp   14
10.10.111.10         75.147.211.20        snat  tcp   4
10.10.111.10         75.147.211.20        snat  tcp   431588
vyatta@MGR1:~$ configure
[edit]
vyatta@MGR1# delete service nat rule 15
[edit]
vyatta@MGR1# delete service nat rule 16
[edit]
vyatta@MGR1# commit
[edit]
vyatta@MGR1# save
Saving configuration to '/opt/vyatta/etc/config/config.boot'...
Done
[edit]
vyatta@MGR1# set service nat rule 15 source address 10.10.111.10
[edit]
vyatta@MGR1# set service nat rule 15 outbound-interface eth0
[edit]
vyatta@MGR1# set service nat rule 15 type masquerade
[edit]
vyatta@MGR1# commit
[edit]
vyatta@MGR1# save
Saving configuration to '/opt/vyatta/etc/config/config.boot'...
Done
[edit]
vyatta@MGR1# show service nat
 rule 10 {
     description WEB208nat
     destination {
         address 75.147.211.17
         port 21,80
     }
     inbound-interface eth0
     inside-address {
         address 10.10.111.200
     }
     protocol tcp
     source {
         address 0.0.0.0/0
     }
     type destination
 }
 rule 11 {
     destination {
         address 0.0.0.0/0
     }
     outbound-interface eth0
     outside-address {
         address 75.147.211.17
     }
     source {
         address 10.10.111.200
     }
     type source
 }
 rule 15 {
     outbound-interface eth0
     source {
         address 10.10.111.10
     }
     type masquerade
 }
[edit]
vyatta@MGR1#


Still cannot hit the web server . I dunno?
Back to top
View user's profile Send private message
stig
Vyatta Employee
Vyatta Employee


Joined: 21 Feb 2008
Posts: 1282
Location: silicon valley

PostPosted: Sat Jan 31, 2009 9:04 pm    Post subject: Reply with quote

If the only thing not working is going from the private address of the laptop to the private address of the websever using the public network, then you'd need nat hairpinning. Can't you set up an internal dns to give you the private address for the webserver instead of trying to use the public?
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Sat Jan 31, 2009 9:13 pm    Post subject: Reply with quote

Hello Stig,

Yes I can do that But why? I don't need this with a firebox? Why with Vyatta....?

That makes little sense that you put a whole set of servers behind a network routed and protected by Vyatta and you cannot even login to the Cpanels on the web?

Strange


Thanks for the help I definitley needed it (Still do Smile
Back to top
View user's profile Send private message
stig
Vyatta Employee
Vyatta Employee


Joined: 21 Feb 2008
Posts: 1282
Location: silicon valley

PostPosted: Sat Jan 31, 2009 9:30 pm    Post subject: Reply with quote

Joseph wrote:
Hello Stig,

Yes I can do that But why? I don't need this with a firebox? Why with Vyatta....?
I'm not familiar with firebox, but if it's nat hair pinning you need then there is an enhancement bug opened (http://bugzilla.vyatta.com/show_bug.cgi?id=3352). You can vote for it on the enhancement poll to raise it's priority.
Back to top
View user's profile Send private message
Joseph
Forum Veteran
Forum Veteran


Joined: 20 Jan 2009
Posts: 114

PostPosted: Sat Jan 31, 2009 9:37 pm    Post subject: Reply with quote

Hello Stig,

Thanks very much I like Vyatta a lot I want to use it. I will vote
and thank you very much for your help!

Smile
Back to top
View user's profile Send private message
conceptcoders
Active Member
Active Member


Joined: 29 Feb 2008
Posts: 29

PostPosted: Mon Feb 2, 2009 12:17 pm    Post subject: Reply with quote

I struggled with this a lot when I first started configuring NAT rules, so I'll try and give an explaination as to how I worked the right rules out for me.

You first need understand what nat rules actually do, by the sounds of it you're 95% the way there already,

When you setup a destination NAT rule such as,

rule 10 {
description WEB208nat
destination {
address 75.147.211.17
port 21,80
}
inbound-interface eth0
inside-address {
address 10.10.111.200
}
protocol tcp
source {
address 0.0.0.0/0
}
type destination
}

There are actually three things being specified.
The first is essentially a packet matching statement.
i.e.
destination {
address 75.147.211.17
port 21,80
}
inbound-interface eth0 // the interface packets arrive on!
protocol tcp
source {
address 0.0.0.0/0
}

The second part
type destination

is the rule type (source or destination) - i.e. what do to when we find a match, are we going to change the destination address or change the source address


and finally the third part, (in the case of a destination rule, change the destination to 10.10.111.200)

inside-address {
address 10.10.111.200
}


So if a computer from the internet attempts to access your webserver on port 80,
You are saying in the above rule that your are expecting packets will arrive at your interface eth0 with destination address set as 75.147.211.17 port 80, and that Vyatta should change the packets destination address to 10.10.111.200 so it can access your webserver.
Your Vyatta box will then route the packet (assuming it won't get blocked by any firewall rules) and will pass the packet out of the interface that contains 10.10.111.200
(eth1) having modified the destination address to 10.10.111.200.


Hopefully you're with me so far...

Now, when you try and make a request from your laptop to the internet using the rule:

rule 200 {
description LAPTOP1:1
destination {
address 0.0.0.0/0
}
outbound-interface eth0
outside-address {
address 75.147.211.20
}
protocol all
source {
address 10.10.111.10
}
type source
}

The matching parts of the rule are:
destination {
address 0.0.0.0/0
}
outbound-interface eth0 // The interface packets will leave on
protocol all
source {
address 10.10.111.10
}

the rule type is
type source (change the source address of the packet)

and finally you're asking it to change the source address to 75.147.211.20

outside-address {
address 75.147.211.20
}


Tells Vyatta that if it sees any traffic from the IP address 10.10.111.10 that is to exit eth0 it should change the source address of the packet from 10.10.111.10 to 75.147.211.20

However, in the case of you wanting to access 75.147.211.17 from your laptop the traffic will enter eth1, and actually leave eth1!

But your web nat rule 10 specifies inbound-interface eth0

So your rule never gets matched and therefore the packet never gets modified.
That's why the laptop can't access your webserver using the public IP.

So, to get this working you just need to make sure that you have a rule that matches the packets coming from your laptop which changes the destination address.
From the earlier posting by robyn, he's saying that if you change
rule 10 from

inbound-interface eth0
to
inbound-interface eth+

it will match packets arriving from all ethernet interfaces, which should mean that packets arriving at eth1 from your laptop will match the rule, and will therefore have the destination address changed to 10.10.111.200

If you want your webserver to see the request from your laptop as coming from your internal IP address, then there's no further changes.
However, if you want your webserver to see the request coming from 75.147.211.20 (the IP address you specified for your laptop's public IP)
Then you can also use the eth+ change on your laptops source nat rule as well.

Hopefully the above makes sense to you.

Whilst products like the firebox hide some of above complexities from you, once you understand how NAT works, you'll realise that actually it's not that complicated after all and that Vyatta has actually been designed to be quite flexible to work in lots of different scenarios.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Vyatta.org Forum Index -> Users All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum