View previous topic :: View next topic |
Author |
Message |
abaddon83 Guru
Joined: 17 Jan 2004 Posts: 494
|
Posted: Thu Mar 31, 2005 5:28 pm Post subject: schede di reti virtuali come gestirle con gli init script? |
|
|
ciao a tutti ho provato a sistemare gli script init.d per gestire una scheda d i rete virtuale ma mi da errori.. quale è la gisuta sintassi?
queto è il mi codice:
Code: | # This is basically the ifconfig argument without the ifconfig $iface
#
iface_eth0="192.168.2.253 broadcast 192.168.2.255 netmask 255.255.255.0"
iface_eth1="192.168.1.253 broadcast 192.168.1.255 netmask 255.255.255.0"
iface_eth1:1="192.168.0.253 broadcast 192.168.0.255 netmask 255.255.255.0"
iface_eth2="192.168.3.253 broadcast 192.168.3.255 netmask 255.255.255.0"
iface_eth3="192.168.4.253 broadcast 192.168.4.255 netmask 255.255.255.0"
# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?
#
#iface_eth0="dhcp"
#dhcpcd_eth0="..."
# For adding aliases to a interface
#
#alias_eth0="192.168.0.3 192.168.0.4"
# NB: The next is only used for aliases.
#
# To add a custom netmask/broadcast address to created aliases,
# uncomment and change accordingly. Leave commented to assign
# defaults for that interface.
#
#broadcast_eth0="192.168.0.255 192.168.0.255"
#netmask_eth0="255.255.255.0 255.255.255.0"
# For setting the default gateway
#
gateway="eth1:1/192.168.0.254"
#gateway="eth1/192.168.1.254"
|
_________________ Abaddon's House
Jabber account: abaddon@jabber.linux.it |
|
Back to top |
|
|
lan Apprentice
Joined: 06 Mar 2004 Posts: 215 Location: Verona, Italy (Romeo & juliet`s City)
|
Posted: Thu Mar 31, 2005 6:16 pm Post subject: |
|
|
scheda di rete virtuale ? in che senso ?
Code: |
iface_NOME_INTERFACCIA_STRAMBA="192.168.4.253 broadcast 192.168.4.255 netmask 255.255.255.0"
|
ad esempio
poi bhe ovviamente
Code: |
cd /etc/init.d
cp net.eth0 net.NOME_INTERFACCIA_STRAMBA
|
per impostare 2 ip a una eth invece c'è semplicemente
Code: |
alias_eth0="192.168.0.3 "
|
che imposta un secondo ip oltre la primo
ciao _________________ --
http://www.giuseppe-marocchio.com
skype: l4nz0r /voice
USH team www.ush.it |
|
Back to top |
|
|
abaddon83 Guru
Joined: 17 Jan 2004 Posts: 494
|
Posted: Thu Mar 31, 2005 10:05 pm Post subject: |
|
|
lan wrote: | scheda di rete virtuale ? in che senso ?
Code: |
iface_NOME_INTERFACCIA_STRAMBA="192.168.4.253 broadcast 192.168.4.255 netmask 255.255.255.0"
|
ad esempio
poi bhe ovviamente
Code: |
cd /etc/init.d
cp net.eth0 net.NOME_INTERFACCIA_STRAMBA
|
per impostare 2 ip a una eth invece c'è semplicemente
Code: |
alias_eth0="192.168.0.3 "
|
che imposta un secondo ip oltre la primo
ciao |
uhmm alias.. nons o se è quello che fa per me.. a me serve ottenere sta cosa qua:
#if config etho:1 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255
#route add default gw 192.168.0.1 dev eth0:1
usando li alias ottengo sta cosa? _________________ Abaddon's House
Jabber account: abaddon@jabber.linux.it |
|
Back to top |
|
|
oRDeX Veteran
Joined: 19 Oct 2003 Posts: 1325 Location: Italy
|
Posted: Thu Mar 31, 2005 10:16 pm Post subject: |
|
|
se l'initscript utilizza ifconfig allora vedrai eth0:0 eth0:1 ecc..se usa iproute2 invece no.
Ma l'effetto è lo stesso..che cambia per i tuoi fini? |
|
Back to top |
|
|
abaddon83 Guru
Joined: 17 Jan 2004 Posts: 494
|
Posted: Thu Mar 31, 2005 10:24 pm Post subject: |
|
|
oRDeX wrote: | se l'initscript utilizza ifconfig allora vedrai eth0:0 eth0:1 ecc..se usa iproute2 invece no.
Ma l'effetto è lo stesso..che cambia per i tuoi fini? |
non ho capito un cazzus... spe
allora gli init nel modo classicco funziano così:
per ottenre questa conf:
Code: |
#ifconfig eth0 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255
|
basta che in net che sta in conf.d scriva:
Code: |
iface_eth0="192.168.0.100 broadcast 192.168.0.255 netmask 255.255.255.0"
|
per ottenere invece questa conf:
Code: |
#ifconfig eth0:1 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
|
ho provato in net che sta in conf.d a scrivere:
Code: |
iface_eth0:1="192.168.1.100 broadcast 192.168.1.255 netmask 255.255.255.0"
|
ma mi da errori....
ora io dico... non penso d'essere l'unico che usa schede di rete virtuali... volevo sapere se gentoo con gli script di init è in grado di gestirli oppure se devo gestirli tramite il clasico ifconfig ecc... _________________ Abaddon's House
Jabber account: abaddon@jabber.linux.it |
|
Back to top |
|
|
gutter Bodhisattva
Joined: 13 Mar 2004 Posts: 7162 Location: Aarau, Aargau, Switzerland
|
Posted: Thu Mar 31, 2005 11:18 pm Post subject: |
|
|
Questo è un estratto (la parte che credo ti interessi) di /etc/conf.d/net.example nel mio baselayout.
La mia versione è quella attualmente in ~x86 ovvero: 1.11.10-r5
Code: | # If you need more than one address, you can use something like this
# NOTE: ifconfig creates an aliased device for each extra IPv4 address
# (eth0:1, eth0:2, etc)
# iproute2 does not do this
#config_eth0=(
# "192.168.0.2/24"
# "192.168.0.3/24"
# "192.168.0.4/24"
#)
# You can also use IPv6 addresses
#config_eth0=(
# "192.168.0.2/24"
# "4321:0:1:2:3:4:567:89ab"
# "4321:0:1:2:3:4:567:89ac"
#) |
_________________ Registered as User #281564 and Machines #163761 |
|
Back to top |
|
|
fat_penguin Apprentice
Joined: 25 Jul 2004 Posts: 294 Location: sud side of Switzerland
|
Posted: Fri Apr 01, 2005 5:58 am Post subject: |
|
|
Se usi invece un baselayout stabile ti basta usare
Code: | alias_eth0="10.10.10.217" |
nel file /etc/conf.d/net.
Riavvii il servizio di rete Code: | /etc/init.d/net.eth0 restart |
e dando un ifconfig avrai
Code: | eth0 Link encap:Ethernet HWaddr 00:01:03:18:F4:DC
inet addr:10.10.10.15 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:88456443 errors:0 dropped:0 overruns:1 frame:0
TX packets:111629280 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:656240800 (625.8 Mb) TX bytes:2978653204 (2840.6 Mb)
Interrupt:5 Base address:0x2000
eth0:1 Link encap:Ethernet HWaddr 00:01:03:18:F4:DC
inet addr:10.10.10.217 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:267470 errors:0 dropped:0 overruns:0 frame:0
TX packets:267470 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:115522300 (110.1 Mb) TX bytes:115522300 (110.1 Mb)
Interrupt:5 Base address:0x2000
|
byebye
fat_penguin[/quote] |
|
Back to top |
|
|
abaddon83 Guru
Joined: 17 Jan 2004 Posts: 494
|
Posted: Fri Apr 01, 2005 11:58 am Post subject: |
|
|
fat_penguin wrote: | Se usi invece un baselayout stabile ti basta usare
Code: | alias_eth0="10.10.10.217" |
nel file /etc/conf.d/net.
Riavvii il servizio di rete Code: | /etc/init.d/net.eth0 restart |
e dando un ifconfig avrai
Code: | eth0 Link encap:Ethernet HWaddr 00:01:03:18:F4:DC
inet addr:10.10.10.15 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:88456443 errors:0 dropped:0 overruns:1 frame:0
TX packets:111629280 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:656240800 (625.8 Mb) TX bytes:2978653204 (2840.6 Mb)
Interrupt:5 Base address:0x2000
eth0:1 Link encap:Ethernet HWaddr 00:01:03:18:F4:DC
inet addr:10.10.10.217 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:267470 errors:0 dropped:0 overruns:0 frame:0
TX packets:267470 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:115522300 (110.1 Mb) TX bytes:115522300 (110.1 Mb)
Interrupt:5 Base address:0x2000
|
byebye
fat_penguin | [/quote]
e ma facendo così ti esce una rete a 8 bit.. se voglio impostarla a 24 bit come faccio? mi scazza passare al baselayout ~x86...
ho provato a passargli sto valore:
alias_eth0="192.168.1.60 broadcast 192.168.0.255 netmask 255.255.255.0"
ma esce un delirio.... _________________ Abaddon's House
Jabber account: abaddon@jabber.linux.it |
|
Back to top |
|
|
abaddon83 Guru
Joined: 17 Jan 2004 Posts: 494
|
Posted: Fri Apr 01, 2005 12:01 pm Post subject: |
|
|
scusate come non detto..
usando:
alias_eth0="192.168.1.60"
pare sistemi in modo giusto anche la netmask a 24bit...
una cosa pero' se io non ho una netmask "normale" ma ad esempio a 28bit va tutto in malora sto trucchetto.... giusto? il broadcast te lo setta di default sull'indirizzo 255 ma se ho una rete a 28bit non è piu' quello.... _________________ Abaddon's House
Jabber account: abaddon@jabber.linux.it |
|
Back to top |
|
|
fat_penguin Apprentice
Joined: 25 Jul 2004 Posts: 294 Location: sud side of Switzerland
|
Posted: Fri Apr 01, 2005 1:44 pm Post subject: |
|
|
Code: |
# For adding aliases to a interface
#
alias_eth0="10.10.10.217"
# NB: The next is only used for aliases.
#
# To add a custom netmask/broadcast address to created aliases,
# uncomment and change accordingly. Leave commented to assign
# defaults for that interface.
#
#broadcast_eth0="192.168.0.255 192.168.0.255"
#netmask_eth0="255.255.255.0 255.255.255.0"
|
byebye
fat_penguin |
|
Back to top |
|
|
|