Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Netzwerkkonfiguration live ändern
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
zipdrive
n00b
n00b


Joined: 30 Jul 2006
Posts: 48

PostPosted: Wed Mar 12, 2008 9:49 pm    Post subject: Netzwerkkonfiguration live ändern Reply with quote

Hallo, ich habe Ärger mit einem Script, dass meine Netzwerkschnittstelle live (ohne Neustart) ändern soll.

Ziel ist es die IP Adresse und den Hostname zu ändern.

Irgendwie funktioniert das so nicht ... Wo liegt der Fehler oder der Fehler im Ansatz?

Code:
echo \(1\) Studnet \(2\) Proxy
read netmode

ifconfig eth0 down

case $netmode in
1) hostname a178025
   ifconfig eth0 xxx.xxx.xxx.xx broadcast xxx.xxx.xxx.255 netmask 255.255.255.0 up
   unset http_proxy;;
2) hostname a178024
   ifconfig eth0 xxx.xxx.xxx.xy broadcast xxx.xxx.xxx.255 netmask 255.255.255.0 up
   export http_proxy=xxx.xxx.xxx.xxx:xxxx;;
esac

env-update && source /etc/profile

if test $netmode -eq 1
then
   ssh -l 120199 xxx.xxx.xxx.xxx
fi


Auch möchte ich das Script gern auch als user starten können!
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Thu Mar 13, 2008 7:31 am    Post subject: Reply with quote

Was genau klappt denn nicht?

Unter X wirst du Probleme bekommen wenn du im laufenden Betrieb den Hostnamen änderst. Das ändern der IP sollte dagegen unproblematisch sein.

Das setzen des Proxy gilt allerdings nur für die aktuelle Terminalsitzung. Alle anderen bekommen davon nichts mit.

das env-update && source profile kannst du dir schenken, hat hier keine Auswirkungen (eventuell negative, weil ein global eingestellter proxy wieder geladen wird)
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
zipdrive
n00b
n00b


Joined: 30 Jul 2006
Posts: 48

PostPosted: Fri Mar 14, 2008 5:52 pm    Post subject: Reply with quote

ok das export kann man sich vll wirklich schenken.

das prblem schein zu sein, dass das ifconfig nach einem neustart die alten werte aus der net.conf einließt, das soll aber nicht so sein
Back to top
View user's profile Send private message
firefly
Watchman
Watchman


Joined: 31 Oct 2002
Posts: 5329

PostPosted: Sat Mar 15, 2008 10:25 am    Post subject: Reply with quote

zipdrive wrote:
ok das export kann man sich vll wirklich schenken.

das prblem schein zu sein, dass das ifconfig nach einem neustart die alten werte aus der net.conf einließt, das soll aber nicht so sein

ifconfig liest garnichts aus einer konfigurationsdatei.

Schau dir mal folgenden thread an, in gentoo ist es möglich verschiedene netzwerkkonfiguration in abhängigkeit des verwendeten softlevels (die zusätzlichen runlevels in gentoo) zu haben

https://forums.gentoo.org/viewtopic-t-450202-highlight-rcuseconfigprofile.html
_________________
Ein Ring, sie zu knechten, sie alle zu finden,
Ins Dunkel zu treiben und ewig zu binden
Im Lande Mordor, wo die Schatten drohn.
Back to top
View user's profile Send private message
Anarcho
Advocate
Advocate


Joined: 06 Jun 2004
Posts: 2970
Location: Germany

PostPosted: Sat Mar 15, 2008 11:11 am    Post subject: Reply with quote

Du hast nichts davon erwähnt das die Änderung nach einem Neustart erhalten bleiben soll.
_________________
...it's only Rock'n'Roll, but I like it!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum