PDA

View Full Version : HTTPD Dual Nic using eth1 instead of eth0


jflesher
2nd March 2009, 10:15 PM
I've just setup Fedora 10 x64 on a Supermicro 7045 with dual nic; I setup a web site and ran into a strange problem; I can't see my website from outside my LAN; checking IP on Internet it sees my IP as coming for my dynamic IP (IP of router/switch) and not my static IP.

eth0: Static IP
eth1: Dynamic IP

These are standard Intel® 82563EB Dual-Port Gigabit Ethernet Controller.
Is there a way to specify the order in which it sees the nic ports?
I'm wonder if I can mix Static and Dynamic IP's; on the outside they resolve to a static IP; the dynamic one shows up as my router/switch IP; but it allows me to access my DHCP computers; this isn't a web server; but a development machine for writing PHP apps.

ifcfg-eth0
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
DNS1=123.123.123.1
GATEWAY=123.123.123.2
HWADDR=00:30:48:7f:0a:66
IPADDR=123.123.123.3
NETMASK=255.255.255.240
ONBOOT=yes
SEARCH="mydomain.net"
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
NM_CONTROLLED=yes
PEERDNS=yes

ifcfg-eth1
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth1
HWADDR=00:30:48:7f:0a:67
ONBOOT=yes
SEARCH="mydomain.net"
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
NM_CONTROLLED=yes
PEERDNS=no

Where 123.123.123.3 is my static IP address.
I should mention that nmap -v -p 80 123.123.123.3 shows an open port on 80

My VirtualHost is setup like:

NameVirtualHost 123.123.123.3
<VirtualHost 123.123.123.3>
ServerName www.mydomain.com
ServerAlias mydomain.com *.mydomain.com
DocumentRoot /var/www/html/mydomain
ServerAdmin webmaster@mydomain.net

RewriteEngine On
RewriteOptions Inherit

ServerSignature Off
DirectoryIndex index.php index.html index.htm index.shtml

SSLEngine off
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
SSLOptions

TransferLog logs/access_log
ErrorLog logs/error_log
LogLevel error
HostNameLookups on
</VirtualHost>

<Directory "/var/www/html/mydomain">
AllowOverride all
Allow from all
</Directory>

Thanks
Jeff

blittle
2nd March 2009, 10:36 PM
httpd.conf


# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80


by default httpd will listen on all interfaces, you can force it to listen on only one IP address by modifying the line listed

jflesher
2nd March 2009, 10:41 PM

If I change it to:
Listen 123.123.123.3:80
HTTPD fails to start.

blittle
2nd March 2009, 10:42 PM
what do your logs say?

are you using selinux?

jflesher
2nd March 2009, 11:03 PM
I couldn't find any errors in log files; I changed it and did a service httpd restart; it said FAILED.

I have seLinux disabled.
The Firewall is open for HTTP/80.

jflesher
2nd March 2009, 11:08 PM
By the way, Thanks for the help.

You might want to update your My Smolt Profile to something like http://www.smolts.org/client/show_all/pub_67aecd7a-4517-4490-b438-a2c1e2d516c8, the new system switched to a public ID; I got to poking around and posted a new thread on this issue.

I just wanted to see what your profile was, I see you are using a Lap Top; but it might be outdated; since it still shows you running F7; unless you are. You can update it using ssmoltSendProfile

I added my Smolt profile link to my signature after seeing yours, good idea.

blittle
3rd March 2009, 12:00 AM
yeah I'm just too lazy to change it :-)

so nothing in /var/log/messages or in /var/log/httpd

hmm strange

try running these commands (to validate your current httpd.conf file)

# httpd -t
# httpd -S

those should return something along the lines of "Syntax OK"

if not, look at the specific lines that are mentioned.

try opening another shell and doing this while starting httpd

tail -f /var/log/httpd-error.log

or afterwards by checking this:

egrep -i 'warn|error' /var/log/httpd-error.log

make sure your DNS client is working aka-your hosts file has a correct entry for this host

123.123.123.123 mywebserver.mydomain.com #should be something along these lines

check the hostname applied to your host and make sure it's the one that's listed in httpd.conf

see what processes are using port 80 and 443, maybe something else has taken those ports so apache can't start correctly

also, if your logs have gotten bigger than 2 Gb they may have been rotated, make sure you're looking at the right logs

edut-btw this should start apache in "debug" httpd -X

that will probably shed some more light on this problem

jflesher
3rd March 2009, 12:37 AM
I get what the setting are and Syntax OK.

If I turn off my eth1 it works fine; its not the HTTP settings its the Dual Nic card.

I have a feeling its due to the Static and Dynamic IP addresses on the same card; I hate to say this; but it was working in Windoze 2003 Server x64 R2.

blittle
3rd March 2009, 12:40 AM
did you try and use debug mode on apache to see what output it generates?

jflesher
3rd March 2009, 12:45 AM
I don't think it will help; it works fine from my LAN; I have 6 servers, I can access it from all of them; its just outside my LAN, or from the Internet, that the problem exist; from the outside it seems to be using eth1 which is my router/switch; inside my LAN it seems to resolve to eth0; don't know why that is; nor do I understand why its using eth1 instead eth0; but that is the problem in a nut shell.

blittle
3rd March 2009, 10:05 PM
by default apache listens on all available interfaces as far as I know, the config is basically listen 0.0.0.0 just like any other service.

You should be able to define it like I showed above, why it's not working in your case I can't say at this point.

jflesher
3rd March 2009, 10:19 PM
I have disabled eth1 for now; till I can figure out how to set it up correctly.

With it disabled (not active) I have the same problem.

But now it works as far as the web site being able to be seen from outside my LAN.

Dual NICs shouldn't be a problem; a lot of people use them; I wonder if anyone is using a static ip on one and a dynamic ip on the other; I'll set it up with a static on both and see what happens.