Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-09-2015, 07:29 PM
|
#1
|
Member
Registered: Dec 2010
Posts: 135
Rep:
|
resolve localhost to IP address
Hello all,
My server name is centos.linux.local. The httpd service is running. I can access the webserver via IP address on the browser 10.0.0.25. But when I type localhost or linux.local or centos.linux.local I get server not found error. Does anyone have any suggestion what I am missing here?
The content of the /etc/hosts file;
[root@centos /]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.25 linux.local
The DNS and named is running also.
[root@centos html]# nslookup centos
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: centos.linux.local
Address: 10.0.0.25
[root@centos html]#
[root@centos html]# nslookup linux.local
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: linux.local
Address: 10.0.0.25
[root@centos html]#
Reverse lookup Zone file located in /var/named
[root@centos named]# vi linux.local.rr.zone
$ORIGIN 25.0.0.in-addr.arpa.
$TTL 86400
@ IN SOA dns1.linux.local. hostmaster.linux.local. (
2001062501 ;serial
21600 ;refresh after 6 hours
3600 ;retry after 1 hour
604800 ;expire after 1 week
86400) ;minimum TTL 1 day
@ IN NS centos.linux.local.
1 IN PTR centos.linux.local.
2 IN PTR centos.linux.local.
3 IN PTR centos.linux.local.
4 IN PTR centos.linux.local.
Forward looku Zone located in /var/named;
$ORIGIN linux.local.
$TTL 86400
@ IN SOA dns1.linux.local. hostmaster.linux.local. (
2001062501 ;serial
21600 ;refresh after 6 hours
3600 ;retry after 1 hour
604800 ;expire after 1 week
86400) ;minimum TTL 1 day
IN NS dns1.linux.local.
IN MX 10 mail.linux.local.
IN A 10.0.0.25
dns1 IN A 10.0.0.25
centos IN A 10.0.0.25
ftp IN A 10.0.0.25
mail IN CNAME centos
www IN CNAME centos
Here is the iptables information;
[root@centos /]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Here is the content of resolve.conf file;
[root@centos /]# cat /etc/resolv.conf
nameserver 127.0.0.1
search linux.local
Static IP address information;
[root@centos /]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=26976c13-ebeb-44f8-a2ce-a1f87ab431d0
ONBOOT=yes
NM_CONTROLLED="no"
BOOTPROTO=none
HWADDR=3C:4A:92:06:C7:AC
IPADDR=10.0.0.25
PREFIX=24
GATEWAY=10.0.0.1
DOMAIN="linux.local"
DNS1=127.0.0.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
Last edited by rewards; 05-09-2015 at 07:33 PM.
|
|
|
05-10-2015, 01:05 PM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,760
|
Quote:
Originally Posted by rewards
Hello all,
My server name is centos.linux.local. The httpd service is running. I can access the webserver via IP address on the browser 10.0.0.25. But when I type localhost or linux.local or centos.linux.local I get server not found error. Does anyone have any suggestion what I am missing here?
|
Where did you type that text? on what host, using what app .....?
|
|
|
05-10-2015, 02:39 PM
|
#3
|
Member
Registered: Dec 2010
Posts: 135
Original Poster
Rep:
|
When I open a browser firefox or IE. On the browser url. When I type www.linux.local or linux.local
|
|
|
05-10-2015, 03:09 PM
|
#4
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,760
|
on the same host or on another one?
|
|
|
05-10-2015, 03:12 PM
|
#5
|
Member
Registered: Dec 2010
Posts: 135
Original Poster
Rep:
|
The Linux OS with Apache web server is on a laptop. I am trying to access it from another computer within the same network LAN. Is there any other configurations needed to be done on the router? In my router there is a section for Tertiary DNS. There is another section in my router called port forwarding/port triggering and services to select such as FTP, HTTP, ICUII, IP Phone, Net Meeting, News etc. Do I have to configure this option? Maybe I am off and I need to do something on the Linux box? Thanks
Last edited by rewards; 05-10-2015 at 04:22 PM.
|
|
|
05-10-2015, 11:22 PM
|
#6
|
Senior Member
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Rep:
|
Ok.... sounds like you need to set up that other computer (the one that you are using FF or IE on... for sure IE you are not using on gnu/linux) to use the linux server as its DNS server. Plus enable access to dns service on the linux server.
What is the output (on the guindous computer) of this?
|
|
|
05-11-2015, 12:40 AM
|
#7
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,760
|
yes, it looks like you need to configure the DNS service. (just a remark: localhost will never work, do not try that)
|
|
|
05-11-2015, 02:58 AM
|
#8
|
Member
Registered: Dec 2010
Posts: 135
Original Poster
Rep:
|
How do you do it? I mean what and where do I configure the server side? Do I need to do something on the client computer also? I want simply to be able to connect to the local LAN Apache web server using domain name instead of typing IP address at the browser url yet I want to be able to have my regular Internet access also. Is it doable? Where to configure DNS service? On the Linux box?
C:\Users\Test>ipconfig/all
Windows IP Configuration
Host Name . . . . . . . . . . . . : DELL-PC
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Wireless LAN adapter Local Area Connection* 12:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
Physical Address. . . . . . . . . : E2-06-E6-D8-E3-8F
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
Physical Address. . . . . . . . . : E0-06-E6-D8-E3-90
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Dell Wireless 1704 802.11b/g/n (2.4GHz)
Physical Address. . . . . . . . . : E0-06-E6-D8-E3-8F
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2601:9:4f82:30:18b1:9d60:dfd6:db6a(Prefer
red)
IPv6 Address. . . . . . . . . . . : 2601:9:4f82:30:e206:e6ff:fed8:e38f(Prefer
red)
Lease Obtained. . . . . . . . . . : Monday, May 11, 2015 12:25:17 AM
Lease Expires . . . . . . . . . . : Monday, May 11, 2015 12:48:41 AM
Temporary IPv6 Address. . . . . . : 2601:9:4f82:30:45b7:da08:908d:e2bc(Prefer
red)
Link-local IPv6 Address . . . . . : fe80::18b1:9d60:dfd6:db6a4(Preferred)
IPv4 Address. . . . . . . . . . . : 10.0.0.22(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Sunday, May 10, 2015 1:20:19 AM
Lease Expires . . . . . . . . . . : Tuesday, May 12, 2015 12:47:51 AM
Default Gateway . . . . . . . . . : fe80::eafc:afff:fe7a:6772%4
10.0.0.1
DHCP Server . . . . . . . . . . . : 10.0.0.1
DHCPv6 IAID . . . . . . . . . . . : 383780582
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1C-DC-3D-16-E0-DB-55-89-B7-C0
DNS Servers . . . . . . . . . . . : 2001:558:feed::1
2001:558:feed::2
75.75.75.75
75.75.76.76
NetBIOS over Tcpip. . . . . . . . : Enabled
|
|
|
05-11-2015, 03:48 AM
|
#9
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,760
|
the most simple solution would be to edit your hosts file: http://helpdeskgeek.com/windows-7/windows-7-hosts-file/
add the following line at the end:
<ip of your linux server> <name of that host>
|
|
|
05-11-2015, 09:38 AM
|
#10
|
Senior Member
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Rep:
|
I guess you need to set up your linux server as the DNS server of the guindous client (remember to open access to named on the firewall of the linux server). That should take care of name resolution on the guindous box.
|
|
|
05-12-2015, 12:46 PM
|
#11
|
Member
Registered: Apr 2013
Location: Arlington, WA
Distribution: Slackware
Posts: 96
Rep:
|
I'm assuming your Linux box's host name is linux and the domain is local (from your hosts file entry).
If so, you've got a number of configuration errors:
your search line in resolv.conf should be:
search local
Your Windows machine's nameservers should be pointing to your Linux box. It appears that you are using DHCP on your router/gateway so you'll have to figure out how to configure that.
Your reverse zone should be:
$ORIGIN 0.0.10.in-addr.arpa.
not
$ORIGIN 25.0.0.in-addr.arpa.
...and also check your named.conf file for the proper matching entry.
In your 'ifcfg-eth0' file, the DOMAIN should be 'local'
Oh, and host names in the forward DNS file should be like 'centos.local'.
That should be a good start....
Last edited by MikeDeltaBrown; 05-12-2015 at 12:48 PM.
|
|
|
05-19-2015, 02:40 PM
|
#12
|
Member
Registered: Dec 2010
Posts: 135
Original Poster
Rep:
|
Thank you all.
|
|
|
All times are GMT -5. The time now is 07:32 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|