I actually tried it out in a quick lab for you.
Router A, an RB1100, with only the following added to a default configuration (also, all interfaces but the one involved in the Lab have been disabled:
[admin@routerA] > /interface vlan export
# jan/02/1970 00:05:28 by RouterOS 4.15
# software id = JAK5-79ZH
#
/interface vlan
add arp=enabled comment="" disabled=no interface=ether1 l2mtu=1594 mtu=1500 \
name=vlan400 use-service-tag=no vlan-id=400
[admin@routerA] > /ip address export
# jan/02/1970 00:05:35 by RouterOS 4.15
# software id = JAK5-79ZH
#
/ip address
add address=10.0.100.1/24 broadcast=10.0.100.255 comment="" disabled=no \
interface=ether1 network=10.0.100.0
add address=10.0.40.1/24 broadcast=10.0.40.255 comment="" disabled=no \
interface=vlan400 network=10.0.40.0
Router B, an RB1100, with only the following added to a default configuration (also, all interfaces but the one involved in the Lab have been disabled:
[admin@routerB] > /interface vlan export
# jan/02/1970 00:07:54 by RouterOS 4.15
# software id = GV7H-25DP
#
/interface vlan
add arp=enabled comment="" disabled=no interface=ether1 l2mtu=1594 mtu=1500 name=vlan400 use-service-tag=no vlan-id=400
[admin@routerB] > /ip address export
# jan/02/1970 00:07:57 by RouterOS 4.15
# software id = GV7H-25DP
#
/ip address
add address=10.0.100.2/24 broadcast=10.0.100.255 comment="" disabled=no interface=ether1 network=10.0.100.0
add address=10.0.40.2/24 broadcast=10.0.40.255 comment="" disabled=no interface=vlan400 network=10.0.40.0
The ether1 ports are directly connected to one another. Ping works on physical interface as well as VLAN interface:
[admin@routerA] > /ping 10.0.100.2 count=5
10.0.100.2 64 byte ping: ttl=64 time=8 ms
10.0.100.2 64 byte ping: ttl=64 time<1 ms
10.0.100.2 64 byte ping: ttl=64 time<1 ms
10.0.100.2 64 byte ping: ttl=64 time<1 ms
10.0.100.2 64 byte ping: ttl=64 time<1 ms
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0/1.6/8 ms
[admin@routerA] > /ping 10.0.40.2 count=5
10.0.40.2 64 byte ping: ttl=64 time=9 ms
10.0.40.2 64 byte ping: ttl=64 time<1 ms
10.0.40.2 64 byte ping: ttl=64 time<1 ms
10.0.40.2 64 byte ping: ttl=64 time<1 ms
10.0.40.2 64 byte ping: ttl=64 time<1 ms
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0/1.8/9 ms
Now a Cisco 2950, with the following configuration added to the default configuration:
Switch#sh run int fa0/1
Building configuration...
Current configuration : 93 bytes
!
interface FastEthernet0/1
switchport trunk allowed vlan 1,400
switchport mode trunk
end
Switch#sh run int fa0/2
Building configuration...
Current configuration : 93 bytes
!
interface FastEthernet0/2
switchport trunk allowed vlan 1,400
switchport mode trunk
end
Switch#sh spann int fa0/1
Vlan Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
VLAN0001 Desg FWD 19 128.1 P2p
VLAN0400 Desg FWD 19 128.1 P2p
Switch#sh spann int fa0/2
Vlan Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
VLAN0001 Desg FWD 19 128.2 P2p
VLAN0400 Desg FWD 19 128.2 P2p
Switch#sh run int vlan 1
Building configuration...
Current configuration : 79 bytes
!
interface Vlan1
ip address 10.0.100.3 255.255.255.0
no ip route-cache
end
Switch#sh vlan id 400
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
400 test active Fa0/1, Fa0/2
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
400 enet 100400 1500 - - - - - 0 0
Remote SPAN VLAN
----------------
Disabled
Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------
Switch#
ether1 on RouterA connects to fa0/1, ether1 on RouterB connects to fa0/2:
Switch#sh cdp nei
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform Port ID
routerB Fas 0/2 89 R MikroTik
routerA Fas 0/1 101 R MikroTik
Switch#
Ping still works on VLAN 1 (between switch and the two routers, switch times out once while ARP hasn't resolved yet), as well as VLAN 400:
[admin@routerA] > /ping 10.0.100.2 count=2
10.0.100.2 64 byte ping: ttl=64 time=4 ms
10.0.100.2 64 byte ping: ttl=64 time<1 ms
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0/2.0/4 ms
[admin@routerA] > /ping 10.0.100.3 count=2
10.0.100.3 ping timeout
10.0.100.3 64 byte ping: ttl=255 time=1 ms
2 packets transmitted, 1 packets received, 50% packet loss
round-trip min/avg/max = 1/1.0/1 ms
[admin@routerA] > /ping 10.0.40.2 count=2
10.0.40.2 64 byte ping: ttl=64 time<1 ms
10.0.40.2 64 byte ping: ttl=64 time<1 ms
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0/0.0/0 ms
Post your switch and router configs as well as a network diagram here if you need further help - you've got it misconfigured somewhere.