I try to entering Manual IP Address from /etc/network/interfaces
like this;

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

but i still can't connected with my internet

but if i try to write /etc/network/interfaces like this

auto eth0
iface eth0 inet dhcp

I can connected with my internet

please help me

Dani AI

Generated

Quick expert note: the behaviour described—static settings in /etc/network/interfaces failing while DHCP works, and later success after editing /etc/resolv.conf—shows two separate issues were touching this thread. fixed name resolution by adding a nameserver, which is why DNS lookups started working. ’s suggestion to avoid DHCP-address collisions and ’s suggestion to add DNS entries are both relevant. The checklist and persistent fixes below explain why the problem happened and how to make a static setup robust.

Basic checks (determine whether it’s IP-level or name-resolution)

ip addr show <iface>
ip route show
ping -c 3 8.8.8.8        # checks raw IP connectivity / routing
ping -c 3 example.com    # checks DNS resolution
cat /etc/resolv.conf     # see current nameserver(s)

If IP pings succeed but hostnames fail, it’s DNS. If IP pings fail, confirm the interface is up, the gateway is present in ip route, and the netmask is correct.

Make DNS persistent for an ifupdown-based static interface

# add under the iface stanza (example)
dns-nameservers 8.8.8.8 1.1.1.1
sudo ifdown <iface> && sudo ifup <iface>

Avoid editing /etc/resolv.conf directly on systems that use resolvconf/NetworkManager/systemd-resolved: those overwrite the file. For systems with resolvconf, put nameservers into /etc/resolvconf/resolv.conf.d/head and run sudo resolvconf -u. For systemd-resolved, configure /etc/systemd/resolved.conf and restart the service.

Other practical notes: pick a static IP outside the router’s DHCP pool (or reserve it in the router) to prevent conflicts, and be aware modern Linux uses predictable interface names (use ip link to find the right name). These steps tie together the suggestions from , and and make a static configuration persistent and reliable.

Recommended Answers

All 5 Replies

Try This or This or This

I search on google as differnt ways.

I suggest that you go ahead and let it get an address from the dhcp server on your system and confirm the subnet your router/dhcp server is using with ifconfig. What you are probably running into is that the dhcp server gives addresses based on the first number in the range which is probably 192.168.1.2. You could try putting the address out beyond what you think the system is using such as 192.168.1.55.

thank's all (Deep Modi, rch1231) because your suggest, now i can connected clinet and server without dhcpserver. just edit file /etc/resolv.conf

nameserver 192.168.1.1

try this

First three line -same as you entered

add DNS server ip

preferred DNS 192.168.1.11(last one is from your ISP)
Alternative DNS 192.168.1.1

We are glad to hear that your thread has been solved.
Now just Mark it as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.