Solved

config Ip address , subnet ,defult gateway, DNS server manully

Posted on 2006-07-12
26
6,614 Views
Last Modified: 2008-01-09
how to config Ip address , subnet ,defult gateway, DNS server manully in linux
0
Comment
Question by:llvllar1on
  • 12
  • 6
  • 4
  • +2
26 Comments
 
LVL 24

Assisted Solution

by:slyong
slyong earned 200 total points
ID: 17095911
I am on Fedora Core 4, the configuration file is in:
/etc/sysconfig/network-scripts/ifcfg-eth0
for IP address, subnet, netmask.

/etc/sysconfig/network
for gateway

/etc/resolv.conf
for DNS servers

after changing the file, do:

# service network restart
0
 
LVL 14

Assisted Solution

by:ppfoong
ppfoong earned 50 total points
ID: 17097219

If you are using Mandriva, can use the command "drakconf".

If you are using Redhat, can use the command "netconfig".

0
 

Author Comment

by:llvllar1on
ID: 17097226
how about suse and gentoo.....   i am using those two
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Assisted Solution

by:noci
noci earned 150 total points
ID: 17097332
Gentoo:

This file does the trick: /etc/conf.d/net
I think the comments tell it all

If you need an f.e. eth0 to configure
then you also need:

ln -s net.lo /etc/init.d/net.eth0
rc-update add net.eth0


In Suse there is config tool too I think it is called yast
0
 

Author Comment

by:llvllar1on
ID: 17097343
any command in suse i can use..............
0
 
LVL 40

Expert Comment

by:noci
ID: 17097388
yast

is the Yet Another Setup Tool.... ;-)
0
 

Author Comment

by:llvllar1on
ID: 17097424
/etc/sysconfig/network/ifcfg-* . here is the place to change ip setting in suse, but i dont know how to active setting after set excluding reboot.
0
 
LVL 40

Assisted Solution

by:noci
noci earned 150 total points
ID: 17097441
/etc/init.d/<networking or net??> restart
should work...


like in gentoo: '/etc/init.d/net.eth0 start' does the trick withou reboot.
0
 
LVL 1

Assisted Solution

by:antoxa
antoxa earned 100 total points
ID: 17101917
you can configure it for current session and this settings will be lost after reboot
for example

ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

WBR
0
 

Author Comment

by:llvllar1on
ID: 17106171
i used vi /etc/sysconfig/network/ifcfg-*. but i dont really know how to modified.
i also tried
ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

and them i typed network restart .  it didnot work either . need help for suse network setting
0
 
LVL 1

Assisted Solution

by:antoxa
antoxa earned 100 total points
ID: 17106232
after

ifconfig eth0 192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0 up
route add default gw 192.168.0.1

and put in /etc/resolv.conf your DNS servers
such as 192.168.0.2

you don't need to do network restart

because network starting scripts doing the same, but with you static options

for manual changes you must know about your network settings
you must know your IP address (in example 192.168.0.100), your netmask (in example 255.255.255.0), broadcast can be calculated from IP address and netmask, but for 192.168.0.100/255.255.255.0 it will be 192.168.0.255, and you must know your DNS servers, for typing it in /etc/resolv.conf
could you try to configure it with your settings and show results
after 'ifconfig bla-bla' you can check your settings by typing 'ifconfig', you will see your network interfaces
after 'route add default bla-bla' you can check your routing table by typing 'route -vn', you will see your default router
after that you can check you network link by pinging your router 'ping IPaddress'
and if pings resulats is OK, you will configure /etc/resolv.conf


0
 
LVL 40

Expert Comment

by:noci
ID: 17106246
In the ifcfg-* files there are variables...

NAME=Value

Like:

NETMASK=...
IP=...
GATEWAY=...

These need to be filled out.

Before you just add values, what is the ip address of your Modem/Router to the internet. (=gateway)
If not available then What is the network address. If your network address is something like:
address: 192.168.0.0
netmask 255.255.255.0
what is your gateway (modem/router)
Lets assume 192.168.0.1
What is your DNS server, lets assume your modem handles that too.

Then:

Either setup the ifcfg-* values or do it for onetime to check...

Assume the one time only:

ifconfig eth0 etc like mentioned before
route add like mentioned before

echo "domain mydomain" >/etc/resolv.conf
echo "nameserver 192.168.0.1" >>/etc/resolv.conf

For manual config DONT restart the network, that would introduce values from the ifcfg-* files.

'cat /etc/resolv.conf '

should show 2 lines.

btw, if one ifcfg-* file exists for an interface please paste it here, I have no Suse
setup so for me thats a wild guess to its contents.

0
 

Author Comment

by:llvllar1on
ID: 17106251
i copied all the setting from my windows such DNS , network, ......
i also ping my route ip 192.168.1.1 . it works . but only for my route ip .
from ifconfig and route , i can see my change is matched.  

not work either....
0
 

Author Comment

by:llvllar1on
ID: 17106355
ifcfg-* file

BOOTPROTO='dhcp ' ------------------------static
BROADCAST =' ' -----------------------192.168.1.255
IPADDR=''-------------------------------192.168.1.5
MTU=''-----------------------------------1500
NAME='Realtek RT8139'
NETMASK= ''----------------------------192.168.1.1
REMOTE_IPADDR=''--------------------192.168.1.1
STARTMODE='auto'
UNIQUE='rBUF.IQxIdihhuH7
USERCONTROL='no'
_nm_name='bus-pci-0000:00:0b.0'


all data in the  side was entered by me.   left side was default
0
 
LVL 1

Expert Comment

by:antoxa
ID: 17106437
NETMASK wrong, it won't be like IP address 192.168.1.1, it will be like 255.255.255.0
0
 

Author Comment

by:llvllar1on
ID: 17106458
sorry , this was my typo. my setting was 255.255.255.0 for netmask......... i am working fine in dhcp
0
 
LVL 1

Expert Comment

by:antoxa
ID: 17106661
please show output of commands:
ifconfig
route -vn
cat /etc/resolv.conf
0
 
LVL 40

Assisted Solution

by:noci
noci earned 150 total points
ID: 17106678
Your values are surrounded by ' marks?

Can you ping an address on the internet?
f.e.
ping 194.109.6.66
or try a traceroute
traceroute -n 194.109.6.66

That woulld tell if routing works at the IP layer works. And how far.

can you give the following information:

netstat -rn
cat /etc/resolv.conf


0
 

Author Comment

by:llvllar1on
ID: 17113307
finally.  i found i didnot put default gateway. and this command--- route add default gw 192.168.0.1--
only last a while. any one know where to write gateway ?
0
 

Author Comment

by:llvllar1on
ID: 17113309
my linux box is suse 10
0
 
LVL 40

Expert Comment

by:noci
ID: 17117937
Isn't it this one?

REMOTE_IPADDR=''--------------------192.168.1.1

Otherwise look for a config file with GATEWAY or such in it
'grep GATEWAY /dir/where/ifcfg-*'
0
 

Author Comment

by:llvllar1on
ID: 17118312
for noci

both of your suggestions are not work.
0
 

Author Comment

by:llvllar1on
ID: 17118323
now every time after I added  --------------route add default gw 192.168.0.1-----------

my network is work.  but i dont want to type every time.
0
 
LVL 24

Accepted Solution

by:
slyong earned 200 total points
ID: 17118337
It is inside your /etc/sysconfig/network/routes.  Edit that file and change the line to:

default 192.168.0.1 - -
0
 

Author Comment

by:llvllar1on
ID: 17119554
cool. how do you know ---slyong???  i was going to that. but i cannot find this files. in fact, this file (routes) didnot exist in my system.  i will give 100 points for this exact question. looking for answer from anyone!

now the network question is solved . thank you!
0
 
LVL 24

Assisted Solution

by:slyong
slyong earned 200 total points
ID: 17119563
llvllar1on,
It is on my SuSE 10.1 also described here http://openskills.info/infobox.php?ID=949.  If the file does not exist, create the file and put in the line:

default 192.168.0.1 - -

also described here http://www.linuxforums.org/forum/suse-linux-help/56290-make-default-gateway-permanent-different-suse-than-red-hat.html
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question