Toon posts:

Netwerkkaart Probleem.. Linux

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik heb het volgende probleem:

ik heb 2 netwerkkaarten in mijn pc zitten. 1 voor het internet (eth0) en 1 voor het lokale netwerk (eth1). Zoals jullie zien werkt de eth0 prima. Eth1 gaat alleen niet goed. Hoe kan ik hier een goed ip-adres voor instellen? Dit moet worden 192.168.1.1 Hij laat hem wel zien in de lijst bij het booten (Realtek.....enz.).
Alvast bedankt.

Hieronder mijn ifconfig.

root@comp1l:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:02:44:33:A2:D8
inet addr:**.***.***.*** Bcast:**.***.***.*** Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MTU:1500 Metric:1
RX packets:4554 errors:0 dropped:0 overruns:0 frame:0
TX packets:1818 errors:0 dropped:0 overruns:0 carrier:0
collisions:1 txqueuelen:100
RX bytes:1169000 (1.1 Mb) TX bytes:281871 (275.2 Kb)
Interrupt:5 Base address:0xa400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 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:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

root@comp1l:~# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:10:A7:10:74:B7
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:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0xa000

  • flipm0
  • Registratie: September 2000
  • Laatst online: 14-11-2025
Uhm, heb je
code:
1
ifconfig eth1 192.168.1.1 netmask 255.255.255.0 up
al eens geprobeerd? :?

Verwijderd

Topicstarter
flipm0 schreef op 12 september 2002 @ 13:46:
Uhm, heb je
code:
1
ifconfig eth1 192.168.1.1 netmask 255.255.255.0 up
al eens geprobeerd? :?
ja heb ik gedaan... het werkt.. maar als ik mijn pc opnieuw boot moet ik het weer opnieuw doen.

Verwijderd

Welke Linux distro heb je en welke versie ?

Verwijderd

Topicstarter
Verwijderd schreef op 12 september 2002 @ 15:15:
Welke Linux distro heb je en welke versie ?
slackware 8.0

Verwijderd

Ah, dan moet je zelf even prutsen met /etc/rc.d/rc.inet1 script. Of ik kan er ook wel eentje posten uit Slackware-8.1. Komt ie:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/sh
# /etc/rc.d/rc.inet1
# This script starts up the base networking system.
#
# Version:
# @(#)/etc/rc.d/rc.inet1 8.1 Tue May 28 15:27:39 PDT 2002 (pjv)

# Edit these values to set up your first Ethernet card (eth0):
IPADDR="127.0.0.1"  # REPLACE with YOUR IP address!
NETMASK="255.255.255.0" # REPLACE with YOUR netmask!
# Or, uncomment the following lines to set up eth0 using DHCP:
USE_DHCP=yes
# If your provider requires a DHCP hostname, uncomment and edit below:
#DHCP_HOSTNAME="CCHOSTNUM-A"

# Edit these values to set up your second Ethernet card (eth1),
# if you have one.  Otherwise leave it configured to 127.0.0.1,
# or comment it out, and it will be ignored at boot.
IPADDR2="127.0.0.1"  # REPLACE with YOUR IP address!
NETMASK2="255.255.255.0" # REPLACE with YOUR netmask!
# Or, uncomment the following lines to set up eth1 using DHCP:
#USE_DHCP2=yes
# If your provider requires a DHCP hostname, uncomment and edit below:
#DHCP_HOSTNAME2="CCHOSTNUM-A"

# Edit the next line to point to your gateway:
GATEWAY="" # REPLACE with YOUR gateway!

# You shouldn't need to edit anything below here.

# Set up the loopback interface:
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

# Set up the eth0 interface:
if [ "$USE_DHCP" = "yes" ]; then # use DHCP to set everything up:
  echo "Attempting to configure eth0 by contacting a DHCP server..."
  # Add the -h option to the DHCP hostname:
  if [ ! "$DHCP_HOSTNAME" = "" ]; then
    DHCP_HOSTNAME="-h $DHCP_HOSTNAME"
  fi
  /sbin/dhcpcd -t 10 ${DHCP_HOSTNAME} -d eth0
elif [ ! "$IPADDR" = "127.0.0.1" -a ! "$IPADDR" = "" ]; then # set up IP statically:
  # Determine broadcast and network addresses from the IP address and netmask:
  BROADCAST=`/bin/ipmask $NETMASK $IPADDR | cut -f 1 -d ' '`
  NETWORK=`/bin/ipmask $NETMASK $IPADDR | cut -f 2 -d ' '`
  # Set up the ethernet card:
  echo "Configuring eth0:"
  echo "ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}"
  /sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
  # If that didn't succeed, give the system administrator some hints:
  if [ ! $? = 0 ]; then
    echo "Your eth0 card was not initialized properly.  Here are some reasons why this"
    echo "may have happened, and the solutions:"
    echo "1. Your kernel does not contain support for your card.  Including all the"
    echo "   network drivers in a Linux kernel can make it too large to even boot, and"
    echo "   sometimes including extra drivers can cause system hangs.  To support your"
    echo "   ethernet, either edit /etc/rc.d/rc.modules to load the support at boot time,"
    echo "   or compile and install a kernel that contains support."
    echo "2. You don't have an ethernet card, in which case you should run netconfig"
    echo "   and configure your machine for loopback. (Unless you don't mind seeing this"
    echo "   error...)"
  fi
fi # set up eth0

# Set up the eth1 interface:
if [ "$USE_DHCP2" = "yes" ]; then # use DHCP to set everything up:
  echo "Attempting to configure eth1 by contacting a DHCP server..."
  # Add the -h option to the DHCP hostname:
  if [ ! "$DHCP_HOSTNAME2" = "" ]; then
    DHCP_HOSTNAME2="-h $DHCP_HOSTNAME2"
  fi
  /sbin/dhcpcd -t 10 ${DHCP_HOSTNAME2} -d eth1
elif [ ! "$IPADDR2" = "127.0.0.1" -a ! "$IPADDR2" = "" ]; then # set up IP statically:
  # Determine broadcast and network addresses from the IP address and netmask:
  BROADCAST2=`/bin/ipmask $NETMASK2 $IPADDR2 | cut -f 1 -d ' '`
  NETWORK2=`/bin/ipmask $NETMASK2 $IPADDR2 | cut -f 2 -d ' '`
  # Set up the ethernet card:
  echo "Configuring eth1:"
  echo "ifconfig eth1 ${IPADDR2} broadcast ${BROADCAST2} netmask ${NETMASK2}"
  /sbin/ifconfig eth1 ${IPADDR2} broadcast ${BROADCAST2} netmask ${NETMASK2}
  # If that didn't succeed, give the system administrator some hints:
  if [ ! $? = 0 ]; then
    echo "Your eth1 card was not initialized properly.  Here are some reasons why this"
    echo "may have happened, and the solutions:"
    echo "1. Your kernel does not contain support for your card.  Including all the"
    echo "   network drivers in a Linux kernel can make it too large to even boot, and"
    echo "   sometimes including extra drivers can cause system hangs.  To support your"
    echo "   ethernet, either edit /etc/rc.d/rc.modules to load the support at boot time,"
    echo "   or compile and install a kernel that contains support."
    echo "2. You don't have an ethernet card, in which case you should fix"
    echo "   /etc/rc.d/rc.inet1 to stop trying to configure eth1. (Unless you don't mind"
    echo "   seeing this error...)"
  fi
fi # set up eth1

# Set up the gateway:
if [ ! "$GATEWAY" = "127.0.0.1" -a ! "$GATEWAY" = "" ]; then
  /sbin/route add default gw ${GATEWAY} metric 1
fi

# End of /etc/rc.d/rc.inet1


Dit script kun je opslaan als /etc/rc.d/rc.inet1 en vervolgens aanpassen waar nodig. De comments zijn wat mij betreft duidelijk. Op deze wijze kun je je eth0 op dhcp zetten (staat ie al) en eth1 fixed instellen. Ook de routering wordt dan gelijk gedaan voor je.
Succes.

Verwijderd

Bij mij (RedHat 7.2) heb ik in /etc/sysconfig/network-scripts een drietal bestanden (yep, drie nic's in m'n router/firewall 8-) ) genaamd ifcfg-eth0, ifcfg-eth1 en (jawel) ifcfg-eth2.
inhoud ifcfg-eth0:
code:
1
2
3
4
5
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.0.0.154
NETMASK=255.0.0.0


Als jij dit iig voor eth0 hebt zou je een ifcfg-eth1 kunnen maken met de juiste gegevens. Dan ff netwerk restarten en het zou moeten werken (reboot als controle)

Verwijderd

Slackware werkt anders dan RedHat. :)

Verwijderd

Topicstarter
thnks janjanjansen!
Pagina: 1