LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-10-2006, 06:45 PM   #1
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565
Blog Entries: 1

Rep: Reputation: 50
Exclamation Internet screwed up from ifconfig


I did something like this just a little while ago to change my IP address
Code:
sudo ifconfig eth0 192.168.0.120 netmask 255.255.255.0 up
and now I canīt connect to the internet at all. It was really stupid to just do it like that, but I didnīt know how to get a static IP address otherwise (Iīm running Xubuntu). Iīd apreciate any help at the moment (Iīm writing this from another machine on the network) and hope to get this resolved fast.
BTW, when I open Firefox, it pops up an error saying that it couldnīt connect to the internet.
Hereīs kinda what iconfig says.
Code:
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:80:C8:F8:4A:53  
          inet addr:192.168.0.120  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:9 Base address:0x5000
Iīll have to fix this from the command line.
here is my network info that I want to be static:
IP: 192.168.0.120 (router is default 192.168.0.1)
Mask: 255.255.255.0
Any help will be greatly appreciated and I apologize if this has been asked before (I searched a lot).
 
Old 04-10-2006, 06:50 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
http://textsnippets.com/posts/show/319

Just use sudo nano /etc/network/interfaces and use the address 192.168.0.120 instead of 192.168.0.100 in the link above...

Then you should just have to do sudo ifdown eth0 and sudo ifup eth0 to restart the network.

Or use /etc/init.d/networking restart (I just found this command)...

Last edited by pljvaldez; 04-10-2006 at 06:52 PM.
 
Old 04-10-2006, 07:30 PM   #3
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
I did what you said, pljvaldez, and I got this:

Quote:
~$ sudo ifconfig -a eth0

Link encap:Ethernet HWaddr 00:08:54:22:0F:32
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:17 Base address:0xec00

lo
Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:402 errors:0 dropped:0 overruns:0 frame:0
TX packets:402 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:14461 (14.1 KiB) TX bytes:14461 (14.1 KiB)
 
Old 04-10-2006, 07:49 PM   #4
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Can you post your /etc/network/interfaces?
 
Old 04-10-2006, 07:55 PM   #5
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
Quote:
Originally Posted by pljvaldez
Can you post your /etc/network/interfaces?
Not really, because Iīm not at home now, but I verified it and I know for a fact that itīs exactly like one in the link you gave me, except for the last part of the IP adress.
BTW, ipconfig doesnīt work. Itīs not installed, but I guess using ifconfig works too.
I rebooted my PC just in case, but no difference.
 
Old 04-10-2006, 07:59 PM   #6
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
ipconfig is a windows command. In linux, it's ifconfig. Hmmmm. That's odd that it didn't work for your setup. It looks like the settings didn't take. That's why I was curious to see the output of the file. To see if maybe there's a typo or something...

Do you have DHCP on your network that you can use? If so, sometimes the router will allow you to do "static DHCP" which is to assign an IP based on the MAC address of your card. Then the machine can continue to use DHCP, but it will always get the same address.
 
Old 04-10-2006, 08:08 PM   #7
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
Here is a screenshot of it http://cory.mensajerofm.org/images/dhcp.jpg

Last edited by ctkroeker; 04-10-2006 at 08:10 PM.
 
Old 04-10-2006, 08:28 PM   #8
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
From what I can tell, no static IP option for you...

I guess when you get home, post your /etc/network/interfaces and we can go from there...
 
Old 04-11-2006, 04:33 PM   #9
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
OK. I got it fixed with some help at ubuntuforums.org
Here is what I did:
Code:
sudo nano /etc/resolv.conf
Write dns information you've got from your ISP like this:
Code:
nameserver [nameserver IP #1] 
nameserver [nameserver IP #2]
Code:
sudo ifconfig eth0 192.168.0.120 netmask 255.255.255.0 up sudo route add default gw 192.168.0.1
Code:
ping 192.168.0.1
to see if you can reach your gateway.
 
Old 04-11-2006, 07:29 PM   #10
ctkroeker
Senior Member
 
Registered: May 2005
Location: Paraguay
Posts: 1,565

Original Poster
Blog Entries: 1

Rep: Reputation: 50
Ok, now I have a problem because when I reboot the /etc/resolv.conf get's overwritten and I have to enter the commands every time I reboot my PC. How can I make it do it automatically every time I boot?
 
Old 04-11-2006, 11:13 PM   #11
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Did you disable the dhcp client?
 
  


Reply

Tags
eth0, ifconfig, internet


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting /sbin/ifconfig to bash command ifconfig flammable2 Fedora 4 11-12-2005 07:58 AM
Where is ifconfig rutski89 Slackware 4 03-03-2005 12:57 PM
ifconfig in RH 7.2??? chosmer Linux - Networking 9 10-08-2003 11:07 PM
ifconfig dexter_modem Linux - Networking 3 02-20-2003 12:02 PM
ifconfig loganwva Linux - Networking 4 04-03-2002 06:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration