can't access the internet anymore

Is there any place where I can see a default hosts file? Apache had issues or errors that said something about error of the hostname can't be found. Well anyways I monkeyed with the hosts file. I need to set things back to where they were... any ideas?

Here is the error I got from apache:

Code:
/usr/local/sbin/apachectl start :
httpd: apr_sockaddr_info_get() failed for (hostname_of_my_computer_here).
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Sun May 29 04:56:19 2011] [warn] NameVirtualHost *:0 has no VirtualHosts
So I played around with the hosts file when I got this issue to try and fix the issue.
 
Here you go

Code:
# $FreeBSD: src/etc/hosts,v 1.16.34.1.6.1 2010/12/21 17:09:25 kensmith Exp $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
#
# Imaginary network.
#10.0.0.2               myname.my.domain myname
#10.0.0.3               myfriend.my.domain myfriend
#
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
#
#       10.0.0.0        -   10.255.255.255
#       172.16.0.0      -   172.31.255.255
#       192.168.0.0     -   192.168.255.255
#
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers.  Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#
 
Thanks. I used that default file. I still can't get the internet working on my server. Plus that Apache error is still there. Can anyone tell me how to fix the issue? I mean this problem occurred weirdly. I notice we lost internet for like 5 mins and then when we got the net back. I notice this issue occurred.

I played around with the hosts file and the apache httpd.conf type files and so far nothing worked. I googled and round many people asking for the same help and I tried their solutions that solved their issues, but it didn't work for me.

What should I do? How to fix this error?
 
Apache needs your FQDN to be setup correctly.

1) Check that you /etc/resolv.conf is pointing to a DNS that can resolve you.
2) Make sure your /etc/hosts contains your machine and domain name.

/etc/hosts
Code:
#
::1                     localhost localhost.my.domain
127.0.0.1               localhost localhost.my.domain
xxx.xxx.xxx.xxx         machine.domain.tld machine
#
 
What's the difference between the machine and domain name? I own 2 domain names for my websites. I did name my computer. I posted like one hour ago on here for the information asked above but it's pending for approval from the mod.

Any good resources that can clarify what I need to have to allow my computer to access the internet?
 
Code:
ifconfig_em0="inet 192.168.1.101 netmask 255.255.255.0"
ifconfig_em1="inet 192.168.1.102 netmask 255.255.255.0"

No. Just no. Never put IP addresses from the same subnet on different interfaces. It will not work.
 
So now you have a routing table that looks like:

Code:
192.168.1.101  link#x  lo0
192.168.1.0/24 link#x  em0
192.168.1.102  link#y  lo0
192.168.1.0/24 link#y  em1

Guess what happens when the system is asked to forward a packed going to address 192.168.1.103 ?

You must have completely distinct subnets on both of those interfaces, something like 192.168.1.0/24 on em0 and 192.168.2.0/24 on em1 would be fine.

Code:
ifconfig_em0="inet 192.168.1.101 netmask 255.255.255.0"
ifconfig_em1="inet 192.168.2.101 netmask 255.255.255.0"
 
hockey97 said:
What do you mean? I got 2 lan ethernet chips. Each I manually assign them a static ip. One is 192.168.1.101 and the other is 192.168.1.102. I want to use both lans. So what should I do then to make this work?
If you need to assign more IPs from that lan then use an alias to your ethernet card.
 
So, would that fix the apache issue too?

I just went and made the changes. Will test the internet to see if it works.
 
I did what you said to do. I changed the 2nd one with the 2 and 101 but I still get no internet. I used that config before and it worked.The config you look at I had this before. I restarted my server and a file system check was forced. They found some errors in the bits. So I said Yes when it asks to delete or correct issues.

So, do you guys think I should reinstall the internet connections? Via the installation cd or by going by command to run the FreeBSD ports?
 
gkontos said:
If you need to assign more IPs from that lan then use an alias to your ethernet card.

I got 2 lans. There is 2 intel ethernet chips. I got 2 connections. It's a full blown server computer. So I hope you're not thinking I am assigning more then one IP address to the same lan line. It's 2 different lines that go to my router. This setup worked before I lost internet for 5 minutes.

Do you guys think I will need to reinstall the internet stuff?
 
What is the default route? You're not using DHCP to set up the interface so you should have a line in your rc.conf like:

Code:
defaultrouter="xxx.xxx.xxx.xxx"

Where xxx.xxx.xxx.xxx is the IP address of the default route.

Edit: Which of the interfaces is "facing" the internet? That interface must have an address in the same subnet as the default router.

Also what is in the file /etc/resolv.conf? The file should have an address of a working DNS forwarder, in most cases it's the same address as the default route:

Code:
domain blahblah
nameserver yyy.yyy.yyy.yyy
 
Right now I am typing this via my server. I got internet access but only by setting it up to use my router. What is a default route? Sorry pretty new to networking.

I thought I can just type in 192.168.1.101 via the network manager, and it would set the lan up where it has a static ip address set on the network. The rc.conf is posted above. I am currently using my router to assign an IP. Jjust so I can write this via my server. Would like my server to get 2 IP addresses statically assigned.


Code:
Solved
 
We can't take away the learning curve, you'll have to acquire knowledge yourself before even trying to set up multiple networks. Separating subnets and setting up a default route are very, very basic things you'll need to get to grips with first.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/config-network-setup.html
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/advanced-networking.html
http://www.freebsd.org/doc/en/books/faq/networking.html
http://people.freebsd.org/~nik/nag/book.html
route(8) (route add default)
netstat(1) (netstat -a, netstat -rn)
ifconfig(8)
 
Nevermind, I solved it by using sysinstall. Then just saying no to router and used the gui to config my network. Plus it works fine right now, and found out what the issue was.Whenever I edited the hostname it would always generate a . at the end.

The only difference between what I showed you and what I can see now is that my hostname dosen't have a . at the end of it. Otherwise the rest is the same. For anyone in this situation I suggest you use the terminal.

Type in sysinstall and then select 'packages' and hit enter. It will ask you if you want to configure the network with the DHCP you hit 'no' unless you want it to config to the router, where the router assigns an ip address to your computer.

If you hit 'no' then you will manually configure the system. You make sure the hostname is what you want it to be and then the ipv4 is where you assigned a static IP. Then click 'ok' and wait until you get a list of software to install. Then you can exit out of terminal.Your network is configured.
 
Look at /etc/rc.conf. again. sysinstall may have added ifconfig lines to it; certainly it changes the current, in-memory config. The problem was two interfaces on the same network. Overriding that through sysinstall doesn't make it magically work, it just changes what you had to something that does work.
 
wblock said:
Look at /etc/rc.conf. again. sysinstall may have added ifconfig lines to it; certainly it changes the current, in-memory config. The problem was two interfaces on the same network. Overriding that through sysinstall doesn't make it magically work, it just changes what you had to something that does work.

Well, here is my old one that didn't work:

Code:
# -- sysinstall generated deltas -- # Tue Sep  7 03:34:24 2010
# Created: Tue Sep  7 03:34:24 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname=demonicproductions.
gnome_enable="YES"
dbus_enable="YES"
hald_enable="YES"    
webmin_enable="YES" 
apache22_enable="YES" 
mysql_enable="YES" 
ftpd_enable="YES" 
network_interfaces=em0\ em1
# -- sysinstall generated deltas -- # Fri Oct  1 02:31:43 2010
ipv6_enable="YES"
ifconfig_em0="inet 192.168.1.101 netmask 255.255.255.0"
ifconfig_em1="inet 192.168.1.102 netmask 255.255.255.0"

Here is the current one that works right now:

Code:
# -- sysinstall generated deltas -- # Tue Sep  7 03:34:24 2010
# Created: Tue Sep  7 03:34:24 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname=demonicproductions
gnome_enable="YES"
dbus_enable="YES"
hald_enable="YES"    
webmin_enable="YES" 
apache22_enable="YES" 
mysql_enable="YES" 
ftpd_enable="YES" 
network_interfaces=em0\ em1
# -- sysinstall generated deltas -- # Fri Oct  1 02:31:43 2010
ipv6_enable="YES"
ifconfig_em1="inet 192.168.1.102 netmask 255.255.255.0"
ifconfig_em0="inet 192.168.1.101 netmask 255.255.255.0"

The only difference is the hostname, one has a . the other doesn't. The ethernet nics or just switch in the list.

The last code thingy is the one that is working. There is just 2 things that sysinstall changed.

It was the . in the hostname and the list order of the nics, em1 first and then em0 which the one that didn't work this was reversed. Yet in the handbook the one that didn't work should work. It was in correct order.

I don't know why this works but it works.
 
Code:
# -- sysinstall generated deltas -- # Tue Sep  7 03:34:24 2010
# Created: Tue Sep  7 03:34:24 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname=[color="Red"]"[/color]demonicproductions[color="Red"]"[/color]
gnome_enable="YES"
dbus_enable="YES"
hald_enable="YES"    
webmin_enable="YES" 
apache22_enable="YES" 
mysql_enable="YES" 
ftpd_enable="YES" 

# Networking - Assumes both interfaces have a wire plugged in.

cloned_interfaces="lagg0"
ifconfig_em0="up"
ifconfig_em1="up"
ifconfig_lagg0="laggproto failover laggport em0 laggport em1 192.168.1.101 netmask 255.255.255.0"
defaultrouter="192.168.1.1" #assuming this is your gateway ip address.

If you have both interfaces wired maybe try something similar to the above. The above configuration uses lagg(7) to configure both interfaces to operate as one. If one interface fails then it will send receive to the other interface.

Also unless your network is using ipv6, you should probably disable it for now until you get ipv4 figured out.
 
Yeah, it works right now. I ran sysinstall once and clicked 'no', the netowork isn't configured.

So it set it up. After that it works perfectly and still works even on reboot. I don't have to keep using sysinstall, just had to do it once.

For some reason my hostname would get a . assigned at the end to it even if I don't put a . at the end. The server would automatically add the . and this was the main issue.

The hostname is demonicproductions and what the server kept doing when I edited the rc.conf and hosts file. It would put host as deomonicproductions. It would do this everytime I edited the file. So I ran the sysinstall and it set the host file and rc.conf hostname to be demonicproductions and everything worked.

The ethernets, there are 2 ones and both are wired. Both have their own IP address statically assigned.

They act as separate connections. I don't know if I should have it this way or not.

I just want to make sure I am using both in good use. Just want to know that my server is running at the maximum load. I am not limiting my resources.

So right now both nics are acting like separate lines. If my server isn't using both for web traffic to my website / webserver then should I do the above and combine them? Would that mean currently I am not using one with my webserver and just using one Ethernet connection?
 
Back
Top